2016-06-23 01:37:10 +03:00
|
|
|
struct Foo
|
|
|
|
{
|
2016-06-29 12:33:31 +03:00
|
|
|
Foo() {}
|
2016-06-27 23:46:25 +03:00
|
|
|
virtual ~Foo() {}
|
2016-06-23 01:37:10 +03:00
|
|
|
virtual int test() const = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Bar : Foo
|
|
|
|
{
|
2016-06-29 12:33:31 +03:00
|
|
|
Bar() {}
|
2016-06-27 23:46:25 +03:00
|
|
|
~Bar() override {}
|
2016-06-23 01:37:10 +03:00
|
|
|
int test() const override { return 0; }
|
|
|
|
};
|
|
|
|
|
|
|
|
int test(Foo const& foo)
|
|
|
|
{
|
|
|
|
return foo.test();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
Bar const bar;
|
|
|
|
return test(bar);
|
|
|
|
}
|