What is an abstract class?
Abstract class is an Object Oriented programming based concept. In simple words, abstract means a non-physical thought, idea, or concept. An abstract class acts as only a base class, which means an abstract class is incomplete. An abstract class is complete with derived class or other child class.
Object oriented programming concept - what is an encapsulation
Purpose of an abstract class

Here, we have different types of cars and trucks. All vehicles have different colors, design and engine types which make them different from each other but they have something in common as all of them have engines, tiers, gears, steering etc. and are used for traveling.
What should be an abstract concept? Vehicle
As shown in the figure given above, vehicle can be a general concept for car and truck. A vehicle provides general information related to car and truck.
Abstract class declaration:
An abstract class is created using “ABSTRACT” keyword before class name.
Example

Abstract class can include both abstract and non-abstract members.
Example

Now, we can create one derived class car to implement abstract method but when we implement an abstract method in derived class, use override keyword before Method name, as shown below.

Now we can create an object in main class but keep in mind, we cannot create an object directly for an abstract class. When any ’abstract class’ is inherited by any other class, we create the objects of that derived class.

Output

Example code

SubashPosted Mar 27, 2017, 8:39 PM
Very good explanation bro..