Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class Design Question
Message
 
To
10/10/2006 05:34:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01160735
Message ID:
01161068
Views:
19
I'm trying to prevent PEM's from being exposed outside the class.

If I want to access method in a subclass, it must be public in the base
class.

Therefore, to make it so that it doesn't appear in an object browser or
in intellisense, it would need to be marked as protected or hidden at
the subclass level.






>Kevin,
>If I understood it right, don't you mean "hidden" instead of "protected"?
>Cetin
>
>>I am creating a PRG-based class library which will be compiled into a DLL.
>>
>>I have created a base class from which all other classes in the library will
>>be based.
>>
>>The issue is that there are some properties and methods created in the
>>base that I don't want exposed outside any of the classes in the library.
>>
>>The solution seems to be to redefine the classes at the child class level
>>as protected and then call back into the parent using DODEFAULT() or the
>>the scope resolution operator.
>>
>>Is there another way to do this? My sample is below
>>
>>
>>DEFINE CLASS ClassBase as Session
>>
>>	DIMENSION aErrorInfo[1]		&& Array of error info
>>	bErrorOccurred = .F.		&& Set to True when an error occurs
>>
>>	** This method will be protected in subclasses
>>	PROCEDURE _HandleError()
>>		
>>		WITH This
>>		
>>			** Save the error info to the error array property
>>			=AERROR(.aErrorInfo)
>>
>>			** Turn on the error flag
>>			.bErrorOccurred = .T.
>>
>>		ENDWITH
>>		
>>	ENDPROC
>>
>>
>>	** This method will be protected in subclasses
>>	PROCEDURE _ResetErrState()
>>	
>>		WITH This
>>
>>			** Reset the error array
>>			DIMENSION .aErrorInfo[1]
>>			.aErrorInfo = ""
>>
>>			** Turn off the error flag
>>			.bErrorOccurred = .F.
>>		
>>		ENDWITH
>>	
>>	ENDPROC
>>
>>
>>
>>ENDDEFINE
>>
>>
>>*** Base class. All PEM's will be hidden in child classes
>>DEFINE CLASS Child AS ClassBase
>>
>>	** Use the scope resolution operator to call base class
>>	** methods that were protected in this class
>>
>>	PROTECTED PROCEDURE _HandleError()
>>**		ClassBase::_HandleError()
>>		DODEFAULT()
>>	ENDPROC
>>
>>	PROTECTED PROCEDURE _ResetErrState()
>>		ClassBase::_ResetErrState()
>>	ENDPROC
>>
>>	PROCEDURE MyProc() AS Boolean
>>		This._ResetErrState()
>>		This._HandleError()
>>	ENDPROC
>>
>>ENDDEFINE
>>
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Reply
Map
View

Click here to load this message in the networking platform