Message
From
27/01/2002 10:23:11
 
 
To
27/01/2002 04:38:18
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00611212
Message ID:
00611261
Views:
17
Oh, I see... If you mean specifying access level not only for sublasses but for classes near-by, you may check the ClassLibrary property in your method - you should make it Public visible in order to allow executing it from code outside the class, but in it you should have some code like this:
LOCAL lcSenderName, lcPreviousStackCmd, loSender, llContinueProceeding

llContinueProceeding = .F.
lcPreviousStackCmd = PROGRAM(PROGRAM(-1)-1)
lcSenderName = SUBSTR(lcPreviousStackCmd, 1, RAT([.],lcPreviousStackCmd)-1)
IF !EMPTY(lcSenderName) AND TYPE(lcSenderName)=[O] Then
	loSender = EVALUATE(lcSenderName)
	IF PEMSTATUS(loSender, 'ClassLibrary', 5) Then
		IF loSender.ClassLibrary == This.ClassLibrary Then
			llContinueProceeding = .T.
		ENDIF
	ENDIF
ENDIF

IF !llContinueProceeding Then
	RETURN .f.	&& or maybe raise an ERROR?
EndIF

*** Your code
Note that in this case this method still can be executed from outside, if the developer subclasses your original class in your library and adds a method that calls the method 'protected' by the code above.

HTH
Zlatin Zlatev,
MCSD (VS6)

Make solutions, not programs!

Previous
Reply
Map
View