Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris  OO-style question  by Ovid
(Cardinal) on Dec 30, 2000 at 00:42 UTC
( #48891=perlquestion: print w/ replies, xml ) Need Help??  I
have a problem that I'm not sure of the best approach to take. I
have a base class that has two sub-classes that inherit from it:
[base] / \ / \ [subclass A] [subclass B] B has similar
functionality to A. A returns some data, B writes the data to a
file, but in a different format than the data returned from A.
Under some circumstances, the data written to the file from B is
in the exact same format as the data returned from A.  However,
I don't want B to inherit A's methods as I don't want the user
accessing them from the object. In other words, I might have  my
$object = A->new; $object->someWeirdMethod; What I don't want is
my $object = B->new; $object->someWeirdMethod; But that happens
if I inherit from A, unless I write a bunch of methods to trap
those calls and let the user know the