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
--
when small people start casting long shadows, it is time to go to bed

In reply to Re^2: Understanding 'Multiple Inheritance' by punkish
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.