最佳答案
假设我有一个纯抽象类(也就是说,一个没有任何实现的抽象类) :
abstract class A {
abstract m(): void;
}
就像在 C # 和 Java 中,我可以使用 延伸的抽象类:
class B extends A {
m(): void { }
}
但是在 C # 和 Java 中的 不像中,我也可以使用 执行的抽象类:
class C implements A {
m(): void { }
}
类 B
和 C
的行为有什么不同? 为什么我会选择其中一个而不是另一个?