In VB4 the TypeOf statement works with any valid object type,not just forms and controls. This allows you to pass objects ofdifferent classes to the same procedure for a class-specific implementation.Here is an example:
'This procedure prints information 'specific to the object referenced 'in the YourObject parameterPublic Sub PrintObjectInfo(YourObject _ As Object) If TypeOf YourObject Is CDesk Then ' tell what type of object this is Print "Object Type: Desk" ' print the number of legs that 'this object has Print "Number of legs: " & Your_ Object.NumberOfLegs ElseIf TypeOf YourObject Is CHouse _ Then ' tell what type of object this is Print "Object Type: House" Print "Number of doors: " & Your_ Object.NumberOfDoors End If ' both classes have the following ' properties Print "Height: " & YourObject. Height & " ft." Print "Width: " & YourObject.Width _ & " ft." Print "Built by: " & YourObject._ BuilderName Print "Purchase date: " & Your_ Object.PurchaseDate Print "Purchase price: $" & Your_ Object.PurchasePrice . . . .End Sub