#include <iostream>
using namespace std;
class Foo;
class Bar;
class Hoge;
class Foo
{
public:
void func() { cout << "func!" << endl; }
Foo(int v) { cout << v << endl; }
Foo() {}
};
class Bar : public Foo
{
public:
Bar() {}
Bar(int v) : Foo(v) {}
};
class Hoge
{
public:
void func() { cout << "Hoge!" << endl; }
};
template <class T>
void call_func(T& t) {
t.func();
}
int main() {
Foo foo;
Bar bar;
Hoge hoge;
foo.func();
bar.func();
hoge.func();
call_func(foo);
call_func(bar);
call_func(hoge);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgRm9vOwpjbGFzcyBCYXI7CmNsYXNzIEhvZ2U7CgpjbGFzcyBGb28KewpwdWJsaWM6Cgl2b2lkIGZ1bmMoKSB7IGNvdXQgPDwgImZ1bmMhIiA8PCBlbmRsOyB9CglGb28oaW50IHYpIHsgY291dCA8PCB2IDw8IGVuZGw7IH0KCUZvbygpIHt9Cn07CgpjbGFzcyBCYXIgOiBwdWJsaWMgRm9vCnsKcHVibGljOgoJQmFyKCkge30KCUJhcihpbnQgdikgOiBGb28odikge30KfTsKCmNsYXNzIEhvZ2UKewpwdWJsaWM6Cgl2b2lkIGZ1bmMoKSB7IGNvdXQgPDwgIkhvZ2UhIiA8PCBlbmRsOyB9Cn07Cgp0ZW1wbGF0ZSA8Y2xhc3MgVD4Kdm9pZCBjYWxsX2Z1bmMoVCYgdCkgewoJdC5mdW5jKCk7Cn0KCmludCBtYWluKCkgewoJRm9vIGZvbzsKCUJhciBiYXI7CglIb2dlIGhvZ2U7CgkKCWZvby5mdW5jKCk7CgliYXIuZnVuYygpOwoJaG9nZS5mdW5jKCk7CgkKCWNhbGxfZnVuYyhmb28pOwoJY2FsbF9mdW5jKGJhcik7CgljYWxsX2Z1bmMoaG9nZSk7CgkKCXJldHVybiAwOwp9