polyvox/cmake/Modules/CheckCXX11Features/cxx11-test-class_override_final.cpp
Matt Williams a24fcc0c03 Add C++11 compiler support detection feature
This is currently copied from http://quickgit.kde.org/index.php?p=scratch%2Fdakon%2Fcmake-cxx11.git
but there is a chance that in future it will be merged into CMake proper.
2012-11-23 15:41:25 +00:00

22 lines
321 B
C++

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;
}