Difference between revisions of "Abstract Class"

esse quam videri
Jump to: navigation, search
Line 7: Line 7:
  
 
=Relevance=
 
=Relevance=
[[Class]]
+
*[[Class]]
[[Instance]]
+
*[[Instance]]
[[Inheritance]]
+
*[[Inheritance]]
  
 
=Explanation=
 
=Explanation=

Revision as of 19:25, 14 June 2019

Definition

An abstract class is a class that cannot be instantiated.

What this means

Think about an animal, maybe you're thinking about a dog or a cat. Both animals belong to the class "Mammal". Now, imagine that a pet owner wants to call their pet. Would they say dog (but with a name of course) or mammal? A mammal is a broad definition, hence calling it anywhere isn't specific enough for humans, let alone computers. So, if we were to call an abstract class in the main method, this wouldn't be possible since it's too broad of a subject.

Relevance

Explanation

Abstract classes are commonly used for inheritance since they cannot be instantiated themselves while a child or descendant does become an instance.

Resources

See also

Notes

External Links