any subclass of an abstract class must either implement all of the abstract methods in the superclass or be iteself declared abstract why?
How sub classes of abstract classes interact?
Collapse
X
-
Basically, an abstract class is a sort of template. In it, it says "any class that uses me will have the following functions, variables, etc.". Everything accessing a subclass of this will therefore assume, that these functions, variables, etc. exist - which will only be the case, if you implemented them.
Of course, you can have another abstract class, that has all stuff that that other one had plus something more - that would be ok without having to implement the functions, because it's still just a "template".
There is also something called an "Interface" , which solves similar problems. To read up on both Interfaces and abstract classes, I'd recommend this article.
Greetings,
Nepomuk
Comment