Skip to content

Tag Archives: cpp-constructor

Class: A class in C++ is the building block, that leads to Object-Oriented programming. It is a user-defined data type, which holds its own data… Read More
Can a destructor be pure virtual in C++? Yes, it is possible to have pure virtual destructor. Pure virtual destructors are legal in standard C++… Read More
Constructor is a special member function that is automatically called by compiler when object is created and destructor is also special member function that is… Read More
  We have discussed an introduction to Constructors in C++. In this post, the copy constructor is discussed.What is a copy constructor? A copy constructor is… Read More
Remain Careful from these two persons new friends and old enemies — Kabir What is static keyword in C++? static keyword can be applied to… Read More
  What is constructor? A constructor is a special type of member function of a class which initializes objects of a class. In C++, Constructor is… Read More
The problem is to create a class such that the non-dynamic allocation of object causes compiler error. For example, create a class ‘Test’ with following… Read More
When we create our own copy constructor, we pass an object by reference and we generally pass it as a const reference. One reason for… Read More
In C++, compiler creates a default constructor if we don’t define our own constructor (See this). Compiler created default constructor has empty body, i.e., it… Read More