Category: C++ Basic

C++ Basic interview questions and answers with example asked in IT Industries. List of C++ interview questions or for freshers and experienced both | Only Real.

What is initialization list in Constructor in C++ Programming?

Answer: Initializer list or initialization list in constructor in C++ programming is used to initialize data members of a class. Constructor of a class can have initialization list prior to constructor body i.e. list of comma separated data members to be initialized followed by a colon ( notice the constructor initialization list order) . for…

Read the full article

In what situations initialization list is must and assignment in constructor body does not help?

Answer: Here is the some of the scenarios where we must use initialization list in C++. Scenario-1: initialization of constant & reference data member of a class. In C++, constant or reference data member variables of a class can only be initialized in the initialization list, not using assignment in constructor body. Both constant and…

Read the full article

What is order of calling constructor and destructor in C++?

Order of execution of constructors and destructors in C++ is frequently asked interview question. For this question, we have to answer c++ constructor call order and destructor call order  in inheritance relationship with a program example.   [NOTE: During answering c++ inheritance destructor order question, it is better to include answer for multiple inheritance constructor call…

Read the full article

What is inline function in C++? Explain with C++ code example

What is inline function in C++ with program example is frequently asked interview question. Answer of inline functions in cpp object oriented programming will include discussion of default inline functions and inline function using keyword inline in a class. NOTE: In an interview, when inline functions in a class is asked another question can be…

Read the full article