AngelScript
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Interfaces

An interface works like a contract, the classes that implements an interface are guaranteed to implement the methods declared in the interface. This allows for the use of polymorphism in that a function can specify that it wants an object handle to an object that implements a certain interface. The function can then call the methods on this interface without having to know the exact type of the object that it is working with.

  // The interface declaration
  interface MyInterface
  {
    void DoSomething();
  }
  // A class that implements the interface MyInterface
  class MyClass : MyInterface
  {
    void DoSomething()
    {
      // Do something
    }
  }

A class can implement multiple interfaces; Simply list all the interfaces separated by a comma.