Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
PROTECTED Keyword
Message
From
04/08/2005 10:33:12
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
PROTECTED Keyword
Miscellaneous
Thread ID:
01038513
Message ID:
01038513
Views:
71
See Help entry at bottom. What does this really do? Does that mean if I have Object.HireDate then it cannot be changed? Could that ever cause "attempting to lock" issues with data? We are having these in one of our processes, and this is the only thing I've found that seems like it could be related.

Here is the snippet of code from our process:
PROTECTED Archive_Tab AS Db_MorningStarDailyHistory  && the archive
PROTECTED MornStar_Tab AS Db_AllPossibleAccounts  && MornStar.dbf
PROTECTED Prices_Tab AS Db_Prices  && Price.dbf
What was the developer trying to accomplish here?

-------------------------------------------------------------------------

Protection and Hiding of Class Members

You can protect or hide properties and methods in a class definition with the PROTECTED and HIDDEN keywords of the DEFINE CLASS command. PROTECTED and HIDDEN properties can be declared together in a comma-separated list. Protected methods must be declared individually.
For example, if you create a class to hold employee information, and you don't want users to be able to change the hire date, you can protect the HireDate property. If users need to find out when an employee was hired, you can include a method to return the hire date.
DEFINE CLASS employee AS CUSTOM
PROTECTED HireDate
  First_Name = ""
  Last_Name = ""
  Address = ""
  HireDate = { - - }

PROCEDURE GetHireDate
  RETURN This.HireDate
ENDPROC
ENDDEFINE
Next
Reply
Map
View

Click here to load this message in the networking platform