Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests - Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests -

Difference between Base Class and Derived Class in C++

Base Class Vs. Derived Class: Explore the Difference between Base Class and Derived Class in C++

In the world of object-oriented programming languages, both base and derived classes play an important role. The base class is the existing class whereas the derived class is one that acquires the properties of a base class. There are many differences between them, let’s explore some major differences between a base class and a derived class.

What is a Base Class?

In an object-oriented programming language, a base class is an existing class from which the other classes are determined and properties are inherited. It is also known as a superclass or parent class. In general, the class which acquires the base class can hold all its members and some further data as well.

Syntax: Class base_classname{ … }.

What is a Derived Class?

A derived class is a class that is constructed from a base class or an existing class. It has a tendency to acquire all the methods and properties of a base class. It is also known as a subclass or child class.

Syntax: Class derived_classname : access_mode base_class_name { … }.

Difference between Base Class and Derived Class in C++

S.No. Base Class Derived Class
1. A base class is an existing class from which the other classes are derived and inherit the methods and properties. A derived class is a class that is constructed from a base class or an existing class.
2. Base class can’t acquire the methods and properties of the derived class. Derived class can acquire the methods and properties of the base class.
3. The base class is also called superclass or parent class. The derived class is also called a subclass or child class.

Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit Card, GATE Syllabus, GATE Previous Year Question Paper, and more.

Also Explore,

Comments

Leave a Comment

Your Mobile number and Email id will not be published.

*

*