#include <iostream>
using namespace std;
struct p2
{
int x, y;
p2(int _x, int _y) : x(_x), y(_y)
{}
};
struct p3
{
int x, y, z;
p3(int _x, int _y, int _z) : x(_x), y(_y), z(_z)
{}
};
//"base" function
void foo(p3 pt)
{
//do something with it
}
//overloaded function
void foo(p2 pt)
{
p3 pt3 = p3(pt.x, pt.y, 1);
foo(pt3);
}
int main() {
foo(p2(1,1));
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RydWN0IHAyCnsKCWludCB4LCB5OwoJCglwMihpbnQgX3gsIGludCBfeSkgOiB4KF94KSwgeShfeSkKCXt9Cn07CgpzdHJ1Y3QgcDMKewoJaW50IHgsIHksIHo7CgkKCXAzKGludCBfeCwgaW50IF95LCBpbnQgX3opIDogeChfeCksIHkoX3kpLCB6KF96KQoJe30KfTsKCi8vImJhc2UiIGZ1bmN0aW9uCnZvaWQgZm9vKHAzIHB0KQp7CiAgICAgIC8vZG8gc29tZXRoaW5nIHdpdGggaXQKfQoKLy9vdmVybG9hZGVkIGZ1bmN0aW9uCnZvaWQgZm9vKHAyIHB0KQp7CiAgICAgcDMgcHQzID0gcDMocHQueCwgcHQueSwgMSk7CiAgICAgZm9vKHB0Myk7Cn0KCmludCBtYWluKCkgewoJZm9vKHAyKDEsMSkpOwoJcmV0dXJuIDA7Cn0=