Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class Design Question
Message
From
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:
01160777
Views:
11
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
>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform