GetBaseClass Function

Action

Returns the base class of the specified class. The base class is also called the original class.

Syntax

dWinBaseClass = GetBaseClass (dWinClass)
Variable Description
dWinBaseClass The name of the base class of dWinClass. DATACLASS.
dWinClass The name of the class whose original class you want to identify. DATACLASS.

Notes

Normally, GetBaseClass on a window class returns the class itself. However, when you override a class definition, 4Test creates a new class that is a subclass of the original class. Classes that are derived from the original class are not affected. In this case, GetBaseClass returns the overridden class. If it is not clear whether a class definition has been overridden, using GetBaseClass is preferable to the GetClass method or the ClassOf function.

Example

[ ] window MainWin TestApplication
[ ] window DialogBox xCheckBox
[ ] 
[ ] winclass MoveableWin : MoveableWin
[ ] Close()
[-] ... print("Moveable is redefined")
	[ ] 
[-] main()
	[ ] WINDOW w
	[-] for each w in {TestApplication, xCheckBox}
		[ ] TestClassOfMoveableWin (w)
	[ ] 
[-] testcase TestClassOfMoveableWin (WINDOW w) appstate none
	[ ] Print(ClassOf(w))
	[ ] Print(GetBaseClass(ClassOf(w)))
	[ ] // MoveableWin has been redefined, so we use GetBaseClass
	[ ] // to compare to those windows originally derived from the
	[ ] // overridden class. This verification will pass.
	[ ] Verify (ClassOf(w) == GetBaseClass(MoveableWin), TRUE, "GetBaseClassOf({w})==MoveableWin")
	[ ] // This verification will fail because MoveableWin was overridden
	[ ] Verify (ClassOf (w) == MoveableWin, TRUE, "ClassOf({w})==MoveableWin")