mercredi 28 janvier 2015

Should abstract classes be used to prevent instantiation


Is preventing the instantiation of a class a valid reason to make it abstract? For example, if I have a class called Gauge which has subclasses HeadingIndicator and AirSpeedIndicator, is it a good idea to make Gauge abstract? Because instances of Gauge are pretty useless on their own, but might be useful as references to its subclasses.





Aucun commentaire:

Enregistrer un commentaire