in reply to Re: Understanding 'Multiple Inheritance'
in thread Understanding 'Multiple Inheritance'
Careful, B is an actual core module.Yes, I am am aware of that. Am just using A, B, C... as placeholders (too many Algebra lessons for my daughter).
It may help decide if you reflect on whether A is-a B and A is-a C. Compare that to your answers to the same question with has-a substituted.
Nice. Put that way, A has-a B and has-a C. Thanks for your aggregation code. I will work with that tact.
That said, could I do something like...
package A; use B; use C; use strict; sub new { my ($class) = @_; bless {}, $class; } sub make_B { my ($self) = shift; return new B(@_); } sub make_C { my ($self) = shift; return new C(@_); } ### and then, in my script... use A; my $a = A->new(); # $a has all the methods of A my $b = $a->make_B('a', 'b'); # now $b has all the methods of B my $c = $c->make_C('c', 'd'); # and $c has all the methods of C
|
|---|