6
Loading subject content…
Loading subject content…
Loading practice questions…
What will be the output of the program?
#include <iostream>
using namespace std;
class A {
public:
A() { cout << "A"; }
~A() { cout << "~A"; }
};
class B : public A {
public:
B() { cout << "B"; }
~B() { cout << "~B"; }
};
int main() {
{ B b; }
cout << endl;
return 0;
}What will be the output of the program?
#include <iostream>
using namespace std;
class A { public: A(int v) { cout << v; } };
class B : public A { public: B() : A(7) { cout << 8; } };
int main() {
B b;
cout << endl;
return 0;
}What will be the output of the program?
#include <iostream>
using namespace std;
class A { public: A() { cout << "A"; } };
class B { public: B() { cout << "B"; } };
class C : public B, public A { public: C() { cout << "C"; } };
int main() { C c; return 0; }