#include <iostream>
struct rect {
int x, y, w, h;
};
std::ostream& operator<<(std::ostream& os, rect r)
{
return os << r.x << " " << r.y << " " << r.w << " " << r.h << '\n';
}
struct A
{
rect bounds;
A(int x, int y, int w, int h)
{
std::cout << "O1: " << x << " " << y << " " << w << " " << h << "\n";
bounds = { x,y,w,h };
std::cout << "O2: " << rect(bounds);
}
};
struct B : A
{
B(rect bounds) : A(bounds.x, bounds.y, bounds.w, bounds.h)
{
std::cout << "T1: " << rect(bounds);
std::cout << "T2: " << rect(this->bounds) << "\n";
}
};
int main()
{
B b({ 300, 200, 200, 200 });
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKc3RydWN0IHJlY3QgewogICAgaW50IHgsIHksIHcsIGg7Cn07CgpzdGQ6Om9zdHJlYW0mIG9wZXJhdG9yPDwoc3RkOjpvc3RyZWFtJiBvcywgcmVjdCByKQp7CiAgICByZXR1cm4gb3MgPDwgci54IDw8ICIgIiA8PCByLnkgPDwgIiAiIDw8IHIudyA8PCAiICIgPDwgci5oIDw8ICdcbic7Cn0KCnN0cnVjdCBBCnsKICAgIHJlY3QgYm91bmRzOwoKICAgIEEoaW50IHgsIGludCB5LCBpbnQgdywgaW50IGgpCiAgICB7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJPMTogIiA8PCB4IDw8ICIgIiA8PCB5IDw8ICIgIiA8PCB3IDw8ICIgIiA8PCBoIDw8ICJcbiI7CiAgICAgICAgYm91bmRzID0geyB4LHksdyxoIH07CiAgICAgICAgc3RkOjpjb3V0IDw8ICJPMjogIiA8PCByZWN0KGJvdW5kcyk7CiAgICB9Cn07CgpzdHJ1Y3QgQiA6IEEKewogICAgQihyZWN0IGJvdW5kcykgOiBBKGJvdW5kcy54LCBib3VuZHMueSwgYm91bmRzLncsIGJvdW5kcy5oKQogICAgewogICAgICAgIHN0ZDo6Y291dCA8PCAiVDE6ICIgPDwgcmVjdChib3VuZHMpOwogICAgICAgIHN0ZDo6Y291dCA8PCAiVDI6ICIgPDwgcmVjdCh0aGlzLT5ib3VuZHMpIDw8ICJcbiI7CiAgICB9Cn07CgppbnQgbWFpbigpCnsKICAgIEIgYih7IDMwMCwgMjAwLCAyMDAsIDIwMCB9KTsKfQ==