You can convert a class to one of its subclasses (called type casting) by using the syntax NewReference := type_to_cast_to[Reference], where type_to_cast_to is the type you want to use. This is a failable expression because the type conversion will fail if the object can’t be converted to that type — for example, if the class is a different type from the subclass.
The following example shows how to convert TaggedDevice, which has the type creative_device_base, to a customizable_light_device type so you can use its specific functions. If the TaggedDevice isn't a Customizable Light device, then it won't call TurnOn().
if (LightDevice := customizable_light_device[TaggedDevice]):
LightDevice.TurnOn()