Base Class

What Does Base Class Mean?

A base class is a class, in an object-oriented programming language, from which other classes are derived. It facilitates the creation of other classes that can reuse the code implicitly inherited from the base class (except constructors and destructors). A programmer can extend base class functionality by adding or overriding members relevant to the derived class.

Advertisements

A base class may also be called parent class or superclass.

Techopedia Explains Base Class

A class derived from a base class inherits both data and behavior. For example, “vehicle” can be a base class from which “car” and “bus” are derived. Cars and buses are both vehicles, but each represents its own specialization of the vehicle base class.

A base class has the following properties:

  • Base classes are automatically instantiated before derived classes.
  • The derived class can communicate to the base class during instantiation by calling the base class constructor with a matching parameter list.
  • Base class members can be accessed from the derived class through an explicit cast.
  • If abstract methods are defined in a base class, then this class is considered to be an abstract class and the non-abstract derived class should override these methods.
  • Abstract base classes are created using the “abstract” keyword in its declaration and are used to prevent direct initiation using the “new” keyword.
Advertisements

Related Terms

Latest Programming Languages Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…