#include <iostream>
using namespace std;
struct A {
A() { cout << "A"; }
~A() { cout << "~A"; }
virtual void operator()() = 0;
};
struct B : A {
B() { cout << "B"; }
~B() { cout << "~B"; }
void operator()() { cout << "B"; }
};
int main(void) {
B b;
A &a = b;
a();
b();
return 0;
}
Login in to like
Login in to comment