An `abstract class` may declare `abstract` methods with no implementation, forcing subclasses to provide one. It cannot be instantiated with `new` directly.
ts
abstract class Token {
constructor(public symbol: string) {}
abstract transfer(to: string, amount: number): boolean;
describe(): string {
return `Token: ${this.symbol}`;
}
}
class Erc20 extends Token {
transfer(to: string, amount: number): boolean {
console.log(`sending ${amount} to ${to}`);
return true;
}
}
// new Token("X"); // error: cannot instantiate an abstract class
const t = new Erc20("USDC");Abstract classes combine shared implementation (`describe`) with an enforced contract (`transfer`) — a middle ground between a plain interface (no shared code) and a concrete base class (nothing enforced).