2016-06-23 01:37:10 +03:00
|
|
|
struct 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-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);
|
|
|
|
}
|