in reply to deep copy, not deep create
Inheritance will take care of your 'overriding' requirements.
To mock around with these concepts, use Class::Prototyped:
use Class::Prototyped; my $european = Class::Prototyped->new( language => 'English', food => 'Europizza', ); my $german = Class::Prototyped->new( 'parent*' => $european, food => 'Wiener Schnitzel', ); my $bavarian = Class::Prototyped->new( 'parent*' => $german, ); print "Default language: ", $bavarian->language(), "\n"; $bavarian->language("Bavarian"); print "Explicitely set language: ", $bavarian->language(), "\n"; print "Default food: ", $bavarian->food(), "\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: deep copy, not deep create
by ryantate (Friar) on May 27, 2004 at 18:18 UTC |