Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing if an object is an instance of a class
Message
From
07/10/2005 05:47:32
 
 
To
07/10/2005 05:33:54
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01057071
Message ID:
01057082
Views:
12
In case anybody wants it too :
FUNCTION InstanceOf
	LPARAMETERS oObject,cClassName
	LOCAL laClassHierarchy,lcClassName,llResult
	DIMENSION laClassHierarchy[1]
	IF VARTYPE(oObject)!="O"
		MyError("Parameter oObject must be of object type")
	ENDIF
	IF VARTYPE(cClassName)!="C"
		MyError("Parameter cClassName must be of character type")
	ENDIF
	lcClassName=UPPER(cClassName)
	ACLASS(laClassHierarchy,oObject)
	IF ASCAN(laClassHierarchy,lcClassName)>0
		llResult=.T.
	ELSE
		llResult=.F.
	ENDIF
	RETURN llResult
ENDFUNC
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform