Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re^2: OO - best way to have protected methodsby gargle (Chaplain) |
on Aug 19, 2005 at 05:31 UTC ( [id://485022]=note: print w/replies, xml ) | Need Help?? |
It just occured to me that I now have public, private and protected variables thrown in for free...
TEXT, SECRET and NOTSOSECRET are fully accessible by package Base. Other packages (has-a's and is a's) have to use methode calls. Classes which inherit from Base can work with TEXT and NOTSOSECRET.Classes which don't inherit can only access TEXT. This works for me I guess. The overhead of calling a method to set/get a variable I can live with, and, actually put to good use to check the setters for invalid parameters. Thanks, all, for the comments and the links!
In Section
Seekers of Perl Wisdom
|
|