[ABE.pm] And another thing...
Ricardo SIGNES
rjbs-perl-abe at lists.manxome.org
Mon May 22 11:00:05 PDT 2006
* "Faber J. Fedor" <faber at linuxnj.com> [2006-05-22T13:04:26]
> On 22/05/06 07:40 -0400, Ricardo SIGNES wrote:
> > * "Faber J. Fedor" <faber at linuxnj.com> [2006-05-17T20:15:08]
> > > How do I pass a variable from the superclass to the subclass? Nothing
> > > I've tried works.
> >
> > I think your phrasing of the question here is confusing and/or confused. I
> > think you mean this, but I might be wrong:
> >
> > How do I make a base class store data that is shared by its derived
> > classes?
>
> Right, but "base class" == "superclass" and "derived class" ==
> "subclass", no?
Right. I mostly changed those words en passant because they're my preferred
terms -- but what I wanted to clarify was "pass a variable." Variables are
passed when you call a routine, which is not what inheritance does. I figured
I knew what you meant, but ...
> Not at all. As I stated before, my problem was not calling the base
> class' construstor when I created the derived class.
...but with the code I provided, you don't need to do that. Perl makes
cumulative method calls (call method in derived class, then less derived class,
then even less derived class) non-trivial, so I prefer to make lots of small
methods that can be entirely replaced. The get_dbh method I provided could be
called from anywhere at any time, without requiring anything cumulative,
including the constructor.
--
rjbs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.pm.org/pipermail/abe-pm/attachments/20060522/acc93998/attachment.bin
More information about the ABE-pm
mailing list