Inheritance
Thinking more about our Animal class structure, if each subclass of the Animal class eats, sleeps, roams, differently and has its own pictures, etc, does it make sense to instantiate an object of the Animal class? How would it eat? Sleep? What about the Feline class? What about the HouseCat class?
As it stands, it would not make sense to instantiate objects of the Animal or Feline classes because they would be written generally, allowing for sub-classes to be created. Thus, we would declare these classes as abstract. An abstract class has some or all of its methods declared as abstract – in other words, the methods have no body, not even empty braces. Just a semicolon after the parenthesis. The other way that a class could be abstract is if one of its private data members was a member of a separate abstract class.
The HouseCat, on the other hand, is concrete. It is a low-level member of the Animal and Feline classes and has definite, complete methods and data members.
Abstract classes are declared as public abstract class Animal{}.
Abstract methods are declared as public abstract returnType methodName( );
Abstraction has its place in programming. Often times, we find that to create quality, reusable code, we must generalize it. But sometimes, we find ourselves being too general, as in the case of an Account, Message, Animal, or Shape. In these cases, as we have seen, it can become detrimental to try and define methods that are too general. Instead, we just define abstract methods, forcing our sub classes then to implement them.