in reply to Re: OO - best way to have protected methods
in thread OO - best way to have protected methods

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!
  • Comment on Re^2: OO - best way to have protected methods