in reply to Understanding 'Multiple Inheritance'
Careful, B is an actual core module.
The OO competition for your subclass is a class which has-a instance of B and has-a instance of C as data members. It is fairly uncommon for multiple inheritance to make more sense than that kind of aggregation.
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.
Because you justify the A class as a sort of opaque wrapper to keep users out of B and C, I suspect that aggregation will win. Your justification doesn't support a logical descent from B and C. An aggregate constructor based on your requirements will look something like this:
Again, don't really use 'B' as a package name, it's taken and will get very confusing.# omit @ISA dance sub new { my $class = shift; bless { Bobj => B->new(@_[0,1]), Cobj => C->new(@_[2,3]) }, $class; }
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Understanding 'Multiple Inheritance'
by punkish (Priest) on Mar 07, 2005 at 05:43 UTC |