What will be printed out as a result of the following code execution?
#include "iostream"

using namespace std;
class A
    A() {constr();}
    virtual ~A() {destr();}
    virtual void constr() const {;}
    virtual void destr()  const {;}

class B: virtual public A
    B() {constr();}
    ~B() {destr();}
    void constr() const {cout << "B" ;}
    void destr()  const {cout << "~B";}

int main()
    A *a, *b;
    a = new A;
    b = new B;

    delete b;
    delete a;

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes