C++ Polymorphism

Polymorphism means having many forms. The word “poly” means many and “morphs” means forms, which means it is the way of performing some task in many ways. That means a single function or an operator functioning in many ways. It is one of the major concepts of Object-oriented programming. Take a real-life example: A woman … Read more

C++ Copy Constructor

A copy constructor in C++ is used to create a copy of an already existed object. It is also used to Initialize one object from another of the same type. There are two types of copy constructor: Default Copy constructor User-Defined constructor Default Copy constructor: The default copy constructor is defined by the compiler when … Read more

C++ Destructor

As the name indicates, a C++ destructor destroys the object of a class as soon as the scope of an object ends. It is opposite to a constructor. When an object goes out of the scope, the compiler automatically calls the destructor function. Also, the destructor has the exact same name as the class, the … Read more

C++ Constructor

In C++, a constructor is a special type of method that is called automatically when an instance of the class (object) is created. The compiler calls the constructor and is used to initialize the data members of a newly created object. The constructor has the same name as its class. Also, it doe not have … Read more

C++ Classes and Objects

C++ is an Object-Oriented Programming Language and classes and objects are the fundamental components of OOP’s. Everything in C++ is linked with classes and objects. The main purpose of C++ is to introduce the OOPs concept in the C programming language which itself is a powerful language. Objects are real-life entity and classes are the blueprint … Read more

C++ Object Oriented Programming (OOP) Concepts

The main purpose of C++ is to introduce the OOPs concept in C programming language which is a powerful language. OOP is a concept of using objects in programming. It is a paradigm that uses objects and classes that aim to implement real-world entities. The entities such as inheritance, abstraction, polymorphism, etc that are used in programming. … Read more

C++ Memory Management

Memory management refers to the process of managing the computer memory while assigning the space to the program’s variable to improve the overall performance. Requirement of Memory Management. We know that data in arrays are stored in a homogeneous way. And we allocate the memory during the array declaration. But in some situations, we may … Read more

C++ Pointer to Pointer

As we know by now that a pointer stores the address of the pointed variable. But it is not the only use, pointer also stores the address of another pointer forming a chain like structure. When we defined the pointer to a pointer, it means the first pointer contains the address of the second pointer … Read more

C++ Passing Pointers to Functions

A function is a user-defined block of codes that executes some specific task assigned to it invoked by its name. If there is an argument to be passed while calling a function then it is called actual arguments. There are two ways to call a function: call by value call by reference In a first … Read more

C++ Null Pointer

We use a null pointer when we do not have the exact address to assign to a pointer. It is considered a good practice and null is assigned at the time of declaration. Therefore the pointer with a null value is called a null pointer. Check the C++ example for the null pointer. Output: The … Read more