Mascara: Next Generation JavaScript compiler

Try it Download Buy About Documentation Blog Contact

Interfaces

Syntax definition [Help]
interface name [ .< typeparameters > ]
       [ extends interface-list ] 
{
   [ interface-members ]
}

An interface defines a set of function or accessor signatures, without implementation. When a class implement an interface, the class is required to provide implementations for the members defined in the interface.

An interface can contain function-declarations and getter/setter declarations, but not variables or nested type definitions.

A function declaration is a function signature without a function body.

Example:

interface Moveable 
{
   function moveTo(x : int, y : int);
}
 
class DialogBox implements Moveable 
{
   ...other members...
   function moveTo(x : int, y : int) {
     ...implementation...
   }
}
X Try!
Mascara JavaScript Generated JavaScript

Translating...
Show compiler settings