in reply to oo perl - using the super-class
Create your sub-classes TransactionA and TransactionB, put Transaction in @ISA for each. Have your Transaction constructor respect inheritance by using the two-argument form of bless. For instance:
And now your end code will be able to say:sub new { my $class = shift; my $self = {}; %$self = @_; # Whatever fits - this is just and example return bless($self, $class); }
and it will all work.my $trans = new TransactionA;
For more take a look at this tutorial.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re (tilly) 1: oo perl - using the super-class
by kevinlyda (Initiate) on Oct 03, 2000 at 18:50 UTC | |
by merlyn (Sage) on Oct 03, 2000 at 18:52 UTC | |
by tilly (Archbishop) on Oct 03, 2000 at 18:53 UTC |