That's the whole point of an abstract class: that it will only ever exist concretely as an instance of the derived class(es). By declaring abstract methods or properties, it is simply forcing the derived class(es) to provide concrete implementations of those members. In this way, if you have an instance of type Base
, you can call myInstance.bar
and you know that the derived class has implemented it because it wouldn't compile otherwise.
By the way, use pascal case when naming methods, i.e. Foo
and Bar
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…