What are abstract classes? What are the distinct characteristics of an abstract class?

Technology CommunityCategory: OOPWhat are abstract classes? What are the distinct characteristics of an abstract class?
VietMX Staff asked 3 years ago

An abstract class is a class that cannot be instantiated and is always used as a base class.
The following are the characteristics of an abstract class:

  • You cannot instantiate an abstract class directly. This implies that you cannot create an object of the abstract class; it must be inherited.
  • You can have abstract as well as non-abstract members in an abstract class.
  • You must declare at least one abstract method in the abstract class.
  • An abstract class is always public.
  • An abstract class is declared using the abstract keyword.

The basic purpose of an abstract class is to provide a common definition of the base class that multiple derived classes can share.