rendered paste body#include <iostream>
using namespace std;
class A {
int i;
public:
A(const int i = 0) :i(i) { cout << "kA"; }
A(const A& a) :i(a.i) { cout << "cA"; }
void operator=(const A& a) { f(a); cout << "eA"; }
virtual void f(const A& a) { cout << "fA"; }
virtual ~A() { cout << "A"; }
};
class B {
A a;
public:
B() { cout << "kB"; }
B(const B& b) :a(b.a) { cout << "cB"; }
~B() { cout << "B"; }
};
int main()
{
A a(5); cout << '\n'; //kA
B b; cout << '\n'; //kAkB
B b1 = b; cout << '\n'; //cAcB
b = b1; cout << '\n'; //fAeA
return 0; //BABAA
}