Example
Classes using basic inheritance
A Dog extends Animal, calls parent in the constructor, and borrows GetName without rewriting it.
Save this as a .alana file, then alana filename.alana. And start coding cute.
define class Animal;
public:
define str name is new;
define constructor(str name);
redefine self.name is name;
end;
define func GetName() returning str;
return self.name;
end;
end;
define class Dog extends Animal;
public:
define constructor(str name);
call parent(name);
end;
end;
define Dog dog is newobj Dog("Rex");
showln call dog.GetName();