Inheritence question

D

Doug Nichols

I have a program where I create an class and pass a hash:

x.pm
package x;

sub new {
my $object = shift;
my $self = ((@_ == 1) ? shift(): { @_ });
return (bless $self, $object);
}
1;


I also have another class y that I would like x to inherit, but I
cannot seem to get the syntax correctly to do all things.

y.pm
package y;
sub new {
my $self = shift;
$self = { MYX => 'HELLO', MYOMY => 'GOODBYE', }
bless $self;
return $self;
}
1;

Can some one give me a hint?

Thanks
dn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top