Learning C++: Inheritance

Learning C++: Inheritance

In this article I’m going to introduce how to perform object inheritance in C++. When we use inheritance in our C++ programs, we are modeling is-a relationships. For example, a dog is-a mammal; a Volkswagen Beetle is-a car; a square is-a shape.

In this article I’m going to introduce how to perform object inheritance in C++. When we use inheritance in our C++ programs, we are modeling is-a relationships. For example, a dog is-a mammal; a Volkswagen Beetle is-a car; a square is-a shape. This means, to use the Volkswagen Beetle as an example, that the Beetle has many of the attributes of the typical car, though it may have some attributes that other cars don’t have, and the attributes it shares with cars may not be identical to other cars. The shape of a Beetle, for example, is completely different than any other car shape. But in general, an object that inherits from another objects will have many features in common with the object it inherits from.

Some Terminology

The class we are going to inherit from is called the base class. The class that is inheriting from another class is called the derived class. A set of classes that include a base class and one or more derived classes is called a class hierarchy. When a derived class inherits from just one base class, that is known as single inheritance. When a derived class inherits from more than one class, that is called multiple inheritance. I will be working with single inheritance in this set of articles.

learning-to-program object-oriented oop-concepts cpp c++

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Object Oriented Programming in C++ | C++ OOPs Concepts | Learn Object Oriented C++

C++ is general purpose, compiled, object-oriented programming language and its concepts served as the basis for several other languages such as Java, Python, Ruby, Perl etc.

How to Find Ulimit For user on Linux

Explains how to find ulimit values of currently running process or given user account under Linux using the 'ulimit -a' builtin command.

Object class in C# | OOP in C# Part-23 | C# OOP Bangla Tutorial

LIKE | COMMENT | SHARE | SUBSCRIBE In this tutorial, I will discussed about Object class in C#. Blog : http://aspdotnetexplorer.blogspot.com Like our page - ...

Object Initializer in C# | C# Bangla Tutorial | Advanced C#

LIKE | COMMENT | SHARE | SUBSCRIBE In this tutorial, I will discussed about Object initializer in C#. Blog : http://aspdotnetexplorer.blogspot.com Like our p...

Extensible dynamic type in C# | Expand Object In C# | C# Bangla Tutorial | Advanced C#

LIKE | COMMENT | SHARE | SUBSCRIBE In this tutorial, I will discussed about Extensible dynamic type in C#. Blog : http://aspdotnetexplorer.blogspot.com Like ...