package Foo; sub new {return bless {} => shift} sub oogle {my $shelf = shift; $self -> {key} = shift} package Bar; our @ISA = qw /Foo/; sub gurgle {my $self = shift; $self -> {key} = shift;}
Both Bar and Foo happen to use the same key, because there's no encapsulation.
Perl na(t)ive OO model stinks, because you've to work hard to get encapsulation. (Note: I'm not saying I want private stuff, I just want encapsulation of the implementation). I do not know a common language whose OO model sucks more than Perls.
Abigail
In reply to Re: Encapsulation through stringification - a variation on flyweight objects
by Abigail-II
in thread Encapsulation through stringification - a variation on flyweight objects
by robartes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |