+ 2
Why abstract classes are used??
2 Antworten
+ 3
Usually abstract classes are used to define interfaces and it is required to have at least one pure virtual operation (method). You want to define a abstract class when a instance can not be created and is used only for inherting from it. When you expect from it's child to have a behaviour as you expect. Check more about iterators and iterable collections.
+ 3
An abstract class can be used as a type of template for other classes, and most commonly used for inheritance.
The best example:
abstract class Animal(){}
then you can extend child class such as: dog, cat, fish.