+ 14
Abstract classes are built strictly to be inherited from, and cannot have objects instantiated from them. If a base class is never going to have an object made from it, it should be declared abstract. Ex: Let's say a hospital system has profiles for their patients and their staff, and those profiles share some details (a name, an address, contact info, etc.). You could make an abstract Person class that has the shared details, and have Patient and Staff classes that inherit from it. Since any person must be one or the other, the Person class is never used directly.
17th Apr 2017, 12:43 AM
Tamra
Tamra - avatar