TypeScript · Classes and modules
abstract class
A base class that cannot be instantiated and may declare abstract members subclasses must implement.
Syntax
abstract class ShapeExample
Example
abstract class Shape {
abstract area(): number;
}
class Square extends Shape {
constructor(private size: number) { super(); }
area() { return this.size ** 2; }
}More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.