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

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

class B: virtual public A
{
public:
    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;
}

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты