Base Class

Why Trust Techopedia

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

Margaret Rouse
Technology Specialist
Margaret Rouse
Technology Specialist

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.