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:

# omit @ISA dance sub new { my $class = shift; bless { Bobj => B->new(@_[0,1]), Cobj => C->new(@_[2,3]) }, $class; }
Again, don't really use 'B' as a package name, it's taken and will get very confusing.

After Compline,
Zaxo


In reply to Re: Understanding 'Multiple Inheritance' by Zaxo
in thread Understanding 'Multiple Inheritance' by punkish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.