Cogito, ergo sum
Extends clause
The extends clause is a mandatory part of class declarations (except for class Object) and an optional part of Interface declarations, state declarations and struct declarations. It defines that the declared item inherits members from the extended item. In case of classes and interfaces, the declared item is called subclass/subinterface or child class/interface of the extended item, while the extended class or interface is called superclass/superinterface or parent class/interface. Similar terminology could be used for extended states and structs, but is relatively uncommon there.
In Unreal Engine 1, the extends keyword can also be replaced by the keyword expands. That keyword is actually used by default when creating new classes via UnrealEd and very early versions of the Unreal Engine will not recognize the keyword extends.
Syntax[edit]
The most common use of an extends clause is a class declaration:
class ClassName extends ParentClass;
The extends clause of a class declaration can be followed by a within clause and optional class modifiers.
Other usages of the extends clause are rare, but one example available in all Unreal Engine games is the Plane struct:
struct Plane extends Vector { var() config float W; };
This declaration inherits the X, Y and Z components of the Vector struct and adds the W component.
Declarations | Preprocessor • Classes • Interfaces • Cpptext • Constants • Enums • Structs • Variables (Metadata) • Replication block • Operators • Delegates • Functions • States • Defaultproperties (Subobjects) |
---|---|
Types | bool • byte • float • int • name • string • Object • Class • Enums • Structs (Vector ⋅ Rotator ⋅ Quat ⋅ Color) • Static arrays • Dynamic arrays • Delegates • Typecasting |
Literals | Boolean • Float • Integer • Names • Objects (None ⋅ Self) • Vectors • Rotators • Strings |
Flow | GoTo • If • Assert • Return • Stop • Switch • While • Do...Until • For • ForEach • Break • Continue |
Specifiers | Super • Global • Static • Default • Const |
UnrealScript | Syntax • .UC • .UCI • .UPKG • Comments • #directives • Native |