in reply to normal objects?
Certainly you could define a base class for both Cow and Beef which would have methods that both would use (via the @ISA method in the package) so that regardless of the condition of the "$bessie", it is still a member of the base class, even after "grind()".package Cow; sub new { my ($this) = shift; my ($class) = ref($this) || $this; my ($meat) = {}; bless ($meat, $class); return $meat; } sub grind { my ($meat) = shift; bless ($meat, "Beef"); return $meat; } package main; my ($bessie) = new Cow(); grind $bessie;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: normal objects?
by mkmcconn (Chaplain) on Jan 25, 2001 at 01:14 UTC | |
by jeffa (Bishop) on Jan 25, 2001 at 01:23 UTC |