#include <iostream>
class Foo {
public:
virtual void bar(void*) { std::cout << "Called: bar(void*)" << std::endl; }
virtual void bar(Foo*) { std::cout << "Called: bar(Foo*)" << std::endl; }
virtual ~Foo() = default;
};
class FooTwo : public Foo {};
int main() {
Foo foo;
FooTwo footwo;
foo.bar(&foo);
foo.bar(&footwo);
footwo.bar(&foo);
footwo.bar(&footwo);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKY2xhc3MgRm9vIHsKICBwdWJsaWM6CiAgICB2aXJ0dWFsIHZvaWQgYmFyKHZvaWQqKSB7IHN0ZDo6Y291dCA8PCAiQ2FsbGVkOiBiYXIodm9pZCopIiA8PCBzdGQ6OmVuZGw7IH0KICAgIHZpcnR1YWwgdm9pZCBiYXIoRm9vKikgIHsgc3RkOjpjb3V0IDw8ICJDYWxsZWQ6IGJhcihGb28qKSIgIDw8IHN0ZDo6ZW5kbDsgfQogICAgCiAgICB2aXJ0dWFsIH5Gb28oKSA9IGRlZmF1bHQ7Cn07CgpjbGFzcyBGb29Ud28gOiBwdWJsaWMgRm9vIHt9OwoKaW50IG1haW4oKSB7CiAgICBGb28gZm9vOwogICAgRm9vVHdvIGZvb3R3bzsKICAgIAogICAgZm9vLmJhcigmZm9vKTsKICAgIGZvby5iYXIoJmZvb3R3byk7CiAgICAKICAgIGZvb3R3by5iYXIoJmZvbyk7CiAgICBmb290d28uYmFyKCZmb290d28pOwp9