Hi folks,

Can anyone point me to some docs relevant to multiple inheritance?

I have two base classes A and B, then a derived class C that inherits from A
and B. Pretty standard, I think:

package A;

sub new {
  my $pkg = shift;
  return bless { _key1 => 'val1', _key2 => 'val2' }, $pkg;
}

package B;

sub new {
  my $pkg = shift;
  return bless {  _key3 => 'val3' _key4 => 'val4' }, $pkg;
}

package C;
use base qw(A B);

sub new {
  my $pkg = shift;
  # Here's where I'm stuck...
}

My problem is that I need the data for class C to inherit the data from
classes A and B in addition to their methods. This implies that C's
constructor will have to call the constructors for A and B and then somehow
merge the data together (without depending on how objects of class A and B
are represented, e.g., as array or hash references). I've read over
perltootc and the docs for Class::Object::Inheritable, but things are still
unclear.

Any ideas?

Thanks,
David

Reply via email to