in reply to classes that use composition
Your MyClass constructor is all wrong:
sub new { my $self = {}; $self->{ObjA_ref} = shift; ## This is the class name Eg. 'MyClass' $self->{ObjB_ref} = shift; ## This is the ClassA ref bless $self; return $self; }
Try something like this:
sub new { my $class = shift; ##NB my $self = {}; $self->{ObjA_ref} = shift; $self->{ObjB_ref} = shift; bless $self, $class; return $self; }
|
|---|