Difference between revisions of "Abstract Class"

esse quam videri
Jump to: navigation, search
(If the Animal Kingdom were an abstract class)
Line 18: Line 18:
 
[[File:Abstract.png| 650px]]
 
[[File:Abstract.png| 650px]]
  
=Resources=
 
 
== See also ==
 
== See also ==
  

Revision as of 15:08, 8 August 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.

If the Animal Kingdom were an abstract class

Abstract.png

See also

Notes

External Links