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; }
In reply to Re: classes that use composition
by BrowserUk
in thread classes that use composition
by 7stud
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |