So, how do I create variables that are visible to subclasses but tell the user not to use them if they know what's good for them?Well, first of all, (IMO), it's never a good idea to access attributes from other classes (or objects) directly. So the user doesn't need to be told that it's a bad idea for a specific class - it's always a bad idea.
Second, if you want to tell the user something, use POD.
If perl doesn't have a concept of protected variables, then class inheritance becomes pointless, surely.Well, Perl doesn't even have the concept of object instance variables. Can't really blame Perl not to have a specific flavour of a thing it doesn't have to begin with. Perl's OO is the opposite of the rest of Perl. Most of Perl is about programmer convenience, letting the programmer focus on the important things, and having the language take care of the details. But when it comes to OO, Perl gives the programmer only two things: @ISA and bless. And that's it. Everything else you have to do yourself.
In reply to Re: use fields, underscores and subclasses
by JavaFan
in thread use fields, underscores and subclasses
by MattLG
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |