#include <iostream>
class A {
public:
virtual A &Get() {
std::cout << "A";
return *this;
}
};
struct B : A {
B &Get() {
std::cout << "B";
return *this;
}
};
int main(int, char *argv[]) {
B b;
A &a1(b), a2(a1), *a3(&a2), *a4(&a1);
b.Get();
a1.Get();
a2.Get();
a3->Get();
a4->Get();
}
Login in to like
Login in to comment