Inheritance & extends, implements & interfaces & mixins
By default all classes inherit from Object.
Extends (inheritance)
class Child extends Parent {
}Implements (interface)
class Thing implements AnotherThing, AThing {
// implement the missing methods
}Mixin
Note: that a mixin is not a class.
This is use full when not all child classes will need what is in the mixin.
mixin Feature {
void func() {
// ...
};
}
class Thing extends Parent with Feature, AnotherMixin {
// ...
}
It can also be restricted to a certain class and its decedents.
You will now also be-able to use methods from that Class as it is guaranteed that those methods will be available.
mixin Feature on ClassName {
void func() {
// ...
};
}