Example
Inheritance using abstract
Shape refuses to exist on its own. Square finishes Area, then a Shape variable holds a Square.
Save this as a .alana file, then alana filename.alana. And start coding cute.
define abstract class Shape;
public:
define abstract func Area() returning decimal;
end;
define class Square extends Shape;
private:
define decimal size is new;
public:
define constructor(decimal size);
redefine self.size is size;
end;
define override func Area() returning decimal;
return self.size times self.size;
end;
end;
define Shape shape is newobj Square(4.0);
showln call shape.Area();