nmerriweather has asked for the wisdom of the Perl Monks concerning the following question:
Things have been getting kind of big lately, and I've realized I need more subclasses. Rather than doing this:$page = A:B:C->new();
Perhaps I should rephrase: my code is making A:B:C when I should probably be making A:B:C:D1 -- but I want the init code in A:B:C to realize that i should be using a subclass instead of the parent class, and then automagically either morph into a subclass, access the subclass methods, or do something that achieves the result so that:$page = A:B:C:D1->new(); $page = A:B:C:D2->new();
$page = A:B:C->new(); $page->check_if_i_should_be_a_subclass_instead(); $page->render(); # render method from A:B:C or A:B:C:D1 based on ab +ove method result
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: OOP - redefining a class
by etcshadow (Priest) on Jun 12, 2005 at 05:25 UTC | |
|
Re: OOP - redefining a class
by spurperl (Priest) on Jun 12, 2005 at 04:27 UTC | |
|
Re: OOP - redefining a class
by adrianh (Chancellor) on Jun 12, 2005 at 21:06 UTC |