vmime/cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-class_override_final.cpp

22 lines
321 B
C++
Raw Normal View History

2013-11-21 21:16:57 +00:00
class base {
public:
virtual int foo(int a)
{ return 4 + a; }
int bar(int a) final
{ return a - 2; }
};
class sub final : public base {
public:
virtual int foo(int a) override
{ return 8 + 2 * a; };
};
int main(void)
{
base b;
sub s;
return (b.foo(2) * 2 == s.foo(2)) ? 0 : 1;
}