package AbstractFoo; ... sub new { my $package = shift; die "Don't subclass AbstractFoo directly!" if $package eq "AbstractFoo"; bless { @_ }, $package; }(Bonus points to whoever sees a way to generalize this even further.)
sub new { die "this is an abstract subclass" if $_[0] eq __PACKAGE__; shift->SUPER::new(@_); }
-- Randal L. Schwartz, Perl hacker
In reply to Re: Re: Why do you need abstract classes in Perl?
by merlyn
in thread Why do you need abstract classes in Perl?
by jeffa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |