Cpp Tutorial: C++ Types of inheritance:

Below are different types of inheritance: 1. Single Inheritance 2. Multiple Inheritance 3. Multilevel Inheritance 4. Hierarchical Inheritance 5. Hybrid Inheritance 6. Multipath Inheritance / Diamond Problem 7. Accessibility in Inheritance 1. Single Inheritance In this type of inheritance, there will be only 1 base class, and one derived class. It can be visualized as […]

Cpp Tutorial: C++ Inheritance

1. Introduction 2. Deriving by different access specifiers: 3. C++ Base class Pointer and Derived class pointer. 4. Virtual Base Class 5. Constructor and Destructor calls in Inheritance 6. Constructor and Destructor calls in Multiple Inheritance 7. Pointers and Inheritance 1. Introduction Inheritance is a way of creating new class with the help of existing […]

Cpp Tutorial: Copy Assignment operator in C++

In this chapter we shall learn about below topics: 1. Introduction 2. Syntax: 3. Need for user defined assignment operator. 4. User defined assignment operator example 1. Introduction: A user defined copy assignment operator is used to create a new object from an existing one by initialization. The compiler creates a default copy constructor and […]

Cpp Tutorial: Copy Constructor in Cpp

In this tutorial we shall understand about below topics. 1. Types of copy constructor 2. Overloaded copy constructor 3. Program for copy constructor 4. Why we need user defined copy constructor? 5. Why the argument to copy constructor should be pass by reference? 6. More complex example of user defined copy constructor: 7. what is […]

Cpp Tutorial: Different types of Constructors in C++

In this tutorial we shall learn about below different types of Constructors: 1. Default Constructor 2. Parameterized constructors 3. Overloading constructors 4. Constructor with default arguments 1. Default constructor: 1. A constructor that does not take any arguments is called as default constructor. 2. When an object is created default constructor is called. 3. Default […]

Cpp Tutorial: Introduction to Constructor and Destructor in C++

In this chapter we shall look at below topics 1. Introduction 2. Constructor and its properties 3. Destructor and its properties 1. Introduction  In the previous chapter we have seen, to initialize the data members we used a helper method like “setters” and “getters” after creating an object. But with the help of constructors we […]

Cpp Tutorial: Different types of Classes in C++

In this chapter we shall look at different types of classes available in C++ 1. Global Classes in C++ 2. Local Classes in C++ 3. Nested Classes in C++ 4. Anonymous classes in C++ 1. Global Classes in C++ 1. Class defined outside of all the functions is called as Global Class. 2. The objects […]

Cpp Tutorial: Scope resolution operator in C++

In this tutorial we shall see different uses of Scope Resolution Operator 1. To access a global variable. 2. In case of multiple inheritance. 3. To Access class static variables. 4. To access static member function 5. To define a function outside the class. 1. To access a global variable. #include <iostream> using namespace std; […]