http://qs1969.pair.com?node_id=54128


in reply to Re: normal objects?
in thread normal objects?

tadman, the part you describe is easier than I thought it would be. But (pardon me for thinking out loud - I promise to read the docs) what if $bessie has the $bessie->eat method, prior to re-blessing and a new $bessie->eat method after the conversion by grind()? Am I confusing myself, or, won't there be a conflict?

mkmcconn

Replies are listed 'Best First'.
(jeffa) 3Re: normal objects?
by jeffa (Bishop) on Jan 25, 2001 at 01:23 UTC
    Yes there will be a conflict. You will need this as well:
    package Beef; use vars qw(@ISA); #if you use strict @ISA = qw(Cow);
    Which is why it's wise to plan out your inheritance tree before you start coding. OOP is only as good as its design.

    To be technical, Beef IS NOT a Cow - a Cow HAS Beef. Take a look into aggregation for alternatives to inheritance.

    Jeff

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    F--F--F--F--F--F--F--F--
    (the triplet paradiddle)