constexpr in C++ explained in detail

The constexpr is a keyword present in C++11. This keyword indicates a constant value or a…

C++ vector : emplace_back vs push_back

C++ vector has these two very special functions. vector push_back function and vector emplace_back function are…

Rule of Three

Rule of three corresponds to automatic generation of 3 special member functions – constructor, destructor and…

How to avoid compiler generated constructor and destructor

To avoid compiler generated constructor and other special functions, a class may declare such functions as…

What is move constructor and why it take r-value?

Since, C++11, apart from existing compiler generated functions 2 more special functions are generated , these…

What happens when exception thrown in constructor?

This means if exception in constructor is thrown then corresponding destructor will not be called. Therefore,…

What is an explicit constructor ?

To stop this automatic conversion, the class should use explicit constructor. Here, constructor is preceded by…

Understanding the order of constructors and destructors

the order of constructors and destructors call for member objects is completely unrelated to the order…

Copy Constructor in C++: Understanding the details

Copy constructor is a special constructor which can construct from and existing object. If the class…

Parametrized constructor: understanding the concept

Parametrized constructor is a user-defined constructor which takes some parameter as argument and constructs. If a…

Which member functions are generated by compiler in class?

These member functions are generated only if needed, i.e., if a copy operation is needed then…

Why virtual functions not called in constructor & destructor ?

During base class construction, virtual functions never go into derived classes and the object behaves as…