Suppose I have a pure abstract class (that is, an abstract class without any implementation):
abstract class A {
abstract m(): void;
}
Like in C# and Java, I can extend the abstract class:
class B extends A {
m(): void { }
}
But unlike in C# and Java, I can also implement the abstract class:
class C implements A {
m(): void { }
}
How do classes B
and C
behave differently? Why would I choose one versus the other?
(Currently, the TypeScript handbook and language specification don't cover abstract classes.)
abstract
was available in TS and this helped me understand it. – Autocatalysisclass C implements A
. I didn't even know it was possible until reading these posts, and I've been in the ts docs a lot lately. – Rhinitis