Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Inheritence question

Reply
Thread Tools

Inheritence question

 
 
Doug Nichols
Guest
Posts: n/a
 
      02-19-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about inheritence Catherine Heathcote Python 5 07-25-2008 04:44 AM
Quick inheritence question andymconline@googlemail.com Java 8 01-05-2008 09:15 AM
Question about attribute inheritence in XML Schemas using <xsd:extension> Sean Bright XML 2 12-17-2003 11:51 PM
Question about logging and inheritence krzyber Java 1 11-20-2003 08:54 PM
multiple inheritence question Michael C. Starkie C++ 4 08-14-2003 02:36 PM



Advertisments