#include <iostream>
template <int N> struct Base
{
Base(int x) : x(x)
{
};
Base &operator = (const Base &other)
{
std::cout << "Base<" << N << ">::operator = (const Base<" << N << "> &)" << std::endl;
x = other.x;
return *this;
}
int x;
};
struct Derived : Base<0>, Base<1>, Base<2>
{
Derived(int x0, int x1, int x2) : Base<0>(x0), Base<1>(x1), Base<2>(x2)
{
}
};
int main(void)
{
Base<0> *b0 = new Base<0>(0);
Base<1> *b1 = new Base<1>(1);
Base<2> *b2 = new Base<2>(2);
Derived *d = new Derived(3, 4, 5);
*b0 = *d;
*b1 = *d;
*b2 = *d;
std::cout << b0->x << std::endl;
std::cout << b1->x << std::endl;
std::cout << b2->x << std::endl;
return 0;
}