fork(1) download
  1. #include <iostream>
  2.  
  3. struct widget
  4. {
  5. struct bar { explicit bar(int) { std::cout << "constructor\n"; } };
  6.  
  7. void bar(int) { std::cout << "function\n"; }
  8. };
  9.  
  10. template<class B>
  11. struct gadget : B
  12. {
  13. void a() { typename B::bar(10); }
  14. void b() { B::bar(10); }
  15. };
  16.  
  17. int main()
  18. {
  19. gadget<widget> x;
  20. x.a();
  21. x.b();
  22. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
constructor
function