in reply to Re: opinions on the best way to inherit class data
in thread opinions on the best way to inherit class data
i think i was perhaps not clear enough about my definition of 'class data', as opposed to 'class defaults', which i believe your response addresses. my apologies.
some typical 'class data' for example might be:
# base class package AbstractMyClass; my $_Class_Count = 0; sub new { my $class = shift; my $this = bless( {}, $class ); ref($this) && $_Class_Count++; return $this; } package MyClass; @MyClass::ISA = ('AbstractMyClass'); sub new { my $class = shift; my $this = $class::SUPER->new( @_ ); # this class' init... return $this; }
if i were to use the code...
use AbstractMyClass; use MyClass; my $amc = new AbstractMyClass (); my $mc = new MyClass ();
...$AbstractMyClass::_Class_Count would be 2, whereas i would have really liked $AbstractMyClass::_Class_Count to be 1, and $MyClass::_Class_Count to be 1. Probably a bad example of the essence of my original question, but nevertheless illustrative of what i am terming 'class data'. thanks, matt aka d_i_r_t_y, since 'zero cool' was taken... ;-)
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: RE: Re: opinions on the best way to inherit class data
by chromatic (Archbishop) on Aug 23, 2000 at 08:33 UTC |