Virtual table/Virtual function in C++

Note that those functions not carrying the keyword virtual in their declaration do not generally appear in the virtual method table. Whenever a class itself contains virtual functions or overrides virtual functions from a parent class the compiler builds a vtable for that class. The Virtual table contains the array…

  • 23
    Shares

Copy Constructor

A copy constructor is called when an object is passed by value. Copy constructor itself is a function. So if we pass argument by value in a copy constructor, a call to copy constructor would be made to call copy constructor which becomes a non-terminating chain of calls. Therefore compiler…

  • 23
    Shares

Delegating Constructors in C++ 11

Sometimes it is useful for a constructor to be able to call another constructor of the same class. This process is called delegating constructors (or constructor chaining).
There is one case i.e. calling the another constructor in member initialize list, which is acceptable…

  • 23
    Shares