+ 1

What will be the output?

#include<iostream>using namespace std;class A{int x;public:A(int i) { x = i; }void print() { cout << x; }};class B: virtual public A{public:B():A(10) { }};class C: virtual public A {public:C():A(10) { }};class D: public B, public C {};int main(){ D d; d.print(); return 0;}

13th Sep 2016, 10:12 AM
subodh Kumar
subodh Kumar - avatar
3 Answers
+ 1
compilation error
13th Sep 2016, 12:21 PM
subodh Kumar
subodh Kumar - avatar
+ 1
Yes compilation error. Need to put "virtual" to print() in class A
13th Sep 2016, 12:47 PM
Venkatesh(Venki)
Venkatesh(Venki) - avatar
0
ANSWER IS 4 SHIT
13th Sep 2016, 1:01 PM
Arbey Jamili
Arbey Jamili - avatar