in reply to OO Perl: subclassing a class through an other one
I had to solve a similar problem recently and the approach I used was to define a method in the main class for creating the secondary class eg:
sub new_elt { my $self = shift; return XML::Twig::Elt->new(@_); }
Then if someone wants to subclass XML::Twig::Elt then they first need to override XML::Twig::new_elt() to return an object of the new class. eg:
sub XML::Twig::new_elt { my $self = shift; return my_elt_class->new(@_); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: OO Perl: subclassing a class through an other one
by adrianh (Chancellor) on May 06, 2003 at 11:17 UTC | |
|
Re: Re: OO Perl: subclassing a class through an other one
by mirod (Canon) on May 06, 2003 at 11:21 UTC | |
by adrianh (Chancellor) on May 24, 2003 at 20:08 UTC |