You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 2, 2021. It is now read-only.
Brad Sharp edited this page Nov 26, 2016
·
3 revisions
Inheritance allows a new class to include all the properties and methods of an existing class. luna offers support for multi-object inheritance which means that a single class can inherit multiple classes.
Occasionally you might have a class which inherits the same properties from two other classes. When this happens the order in which you inherited the classes is used to decide where the property will be inherited from.
localanimal=class {
Species="";
}
localwinged=class {
Fly=function (this)
print'I can fly!'end;
Wings=2;
}
localflightless=class {
Fly=function (this)
print("I can't fly, but I have " ..this.Wings.." wings")
end;
Wings=2;
}
localbird=class (animal, winged) {}
localemu=class (flightless, bird) {
Species="Emu";
}