Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting Rid of Public Variables
Message
From
15/11/2001 17:47:46
 
 
To
15/11/2001 15:43:10
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00582351
Message ID:
00582432
Views:
24
>Ok, I've been reading some discussions lately, here and elsewhere, regarding not using Public variables. It makes sense to me. My question is simple: If I have an object or process (or in real life, many) that is dependent on values determined by another object or process, how does that value get used where it's needed if it is not Public? Thanks!
>

Just thought I'd throw in my 2cents here. I wouldn't say that Public variables are "bad", but just that they don't have a place in the world of Object Oriented Programming. One of the key concepts in OOP is encapsulation. The "black box" analogy comes to mind. An object is like a black box. I don't know (or care) how the black box does its job (internally) - I just know/care that it works. I tell it to do something and it returns a result. The inards of the black box are hidden and protected from the outside world. The black box can function on its own without help from any other black boxes. The black box has an "interface" by which other objects can request information. "Messaging" is how objects communicate with each other and that is what you are asking about. The black box's exposed methods and properties are its interface and other objects can send messages to "get at" the black box's information. In the case of your check box, you access that check boxes exposed value property directly instead of creating a public variable and storing the value of the check box there.
Previous
Reply
Map
View

Click here to load this message in the networking platform