fork(1) download
  1. #include <iostream>
  2.  
  3. template<class D>
  4. struct widget
  5. {
  6. void foo() { reinterpret_cast<D*>(this)->bar(); }
  7. };
  8.  
  9. struct gadget : private widget<gadget>
  10. {
  11. using widget::foo;
  12. void bar() { std::cout << "gadget\n"; }
  13. };
  14.  
  15. int main()
  16. {
  17. gadget g;
  18. g.foo();
  19. }
  20.  
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
gadget