+ 2

Why abstract classes are used??

23rd Mar 2018, 1:55 PM
Akshay Karande
2 Answers
+ 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.
24th Mar 2018, 11:29 AM
Andreea Pupaza
+ 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.
30th Jun 2018, 1:12 PM
Ashi Soni
Ashi Soni - avatar