Skip to main content

Abstract Classes

An abstract class cannot be instantiated directly — it serves as a base for other classes.


Syntax

Shape abstract class {
abstract Area method() as float;
}

Abstract Methods

Methods marked abstract have no body — subclasses must implement them:

AbstractFeature abstract class {
abstract Run method() as int;
}

Implementing Abstract Methods

ConcreteFeature class inherits AbstractFeature {
override Run method() as int {
return 42;
}
}

Cannot Instantiate

s is Shape();    // ❌ compile error — abstract
c is ConcreteFeature(); // ✅ OK

Next Steps