Consider the below C++ program.
Which of the below is not printed?
This question is contributed by Sudheendra Baliga
(D) All of the above
Explanation: Output will be 13571358 as 1357 (for D d1) and as 1358 (for D d(d1))……reason is that ……during inheritance we need to explicitly call copy constructor of base class otherwise only default constructor of base class is called. One more thing, as we are using virtual before base class, there will be only one copy of base class in multiple inheritance. And without virtual output will be……13157….&…13158 as (1315713158) respectively for each derived class object.
Quiz of this Question