Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: OO - best way to have protected methods

by gargle (Chaplain)
on Aug 19, 2005 at 05:31 UTC ( [id://485022]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://485022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2024-04-23 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found