boost_no_cxx11_final.ipp 764 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // (C) Copyright Agustin Berge 2014
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for more information.
  6. // MACRO: BOOST_NO_CXX11_FINAL
  7. // TITLE: C++11 final class-virt-specifier
  8. // DESCRIPTION: The compiler does not support the C++ class-virt-specifier final
  9. namespace boost_no_cxx11_final {
  10. struct X final {};
  11. struct abstract
  12. {
  13. virtual int f() = 0;
  14. };
  15. struct derived : public abstract
  16. {
  17. virtual int f() final
  18. {
  19. return 0;
  20. }
  21. };
  22. int check(abstract* pa)
  23. {
  24. return pa->f();
  25. }
  26. int test()
  27. {
  28. derived d;
  29. return check(&d);
  30. }
  31. }