+ 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;}
3 Answers
+ 1
compilation error
+ 1
Yes compilation error. Need to put "virtual" to print() in class A
0
ANSWER IS 4 SHIT