Type Casts

To access elements of an object that are only defined in a derived class, you can cast an object to a derived class.

Example:

There is a class "Vehicles" and derived from it a class "Car". In the "Car" class, a variable is defined with the name "Motor".

In the Start class, a TCE object named Vehicle is defined with the TCE Class "Vehicles". The variable is initialized with "Car".

How can the variable "Motor" of the class "Car" be accessed by the object Vehicle?

Dim V1 As String

V1 := Vehicle:Car.Motor

 

Attention:

Type casts should always be performed with a previous type check to avoid interpreter errors:

V1 := Vehicle:Car.Motor If Vehicle IsA ::Car