The concept of interfaces is available in UnrealEngine 3 UnrealScript and also in some UnrealEngine 2 games.
Syntax
Interface definitions look a lot like class definitions:
interface InterfaceName [extends ParentInterface] {modifiers}
Generally, all class modifiers are also allowed for interfaces. In reality, only the following two modifiers make sense:
- DependsOn(type names)
- One or more classes and/or interfaces (separated by comma) that need to be parsed before this interface, because types declared in there are used by this interface. This modifier can be used multiple times.
(Parent interfaces need not be specified here because the compiler always parses parent classes first.)
- Native(library name)
- Specified for interfaces that include native code.
Interfaces can define the following member types:
Interfaces may not contain states, variable declarations or replication blocks. Note that while a defaultproperties block is allowed, it wouldn't make much sense due to the lack of variables. Functions and delegates should not have any modifiers or body. Native interfaces may contain native functions, though.
Note: It is possible, but not advisable, to include a function body for functions and delegates. Functions and delegates must be redefined in classes implementing the interface and it is not possible to reach the interface's implementation of the function through something like the super keyword.
Usage
- TODO
See Also
- Interface (UT3) – the UT3 interface base class
- Wikipedia:Interface (Java) – Java interfaces (very similar to UnrealScript interfaces)
Category:Legacy To Do – explain usage