fork download
  1. #include <iostream>
  2.  
  3. template <typename T> struct Foo {
  4.  
  5. void CallBar () {
  6. Bar();
  7. }
  8.  
  9. virtual void Bar() {
  10. int meow = 5;
  11. SelectiveFoo( meow );
  12. };
  13.  
  14. template <typename S> void SelectiveFoo ( S selective ) {
  15. std::cout << "Kung ~Foo~!\n";
  16. }
  17. };
  18.  
  19. struct Baz : public Foo<int> {
  20.  
  21. /*void Bar () {
  22.   std::cout << "Bars everywhere, bitches.\n";
  23.   }*/
  24.  
  25. template <typename S> void SelectiveFoo (S selective) {
  26. std::cout << "For the greater good, and for Bazzes everywhere!\n";
  27. }
  28.  
  29. };
  30.  
  31. int main (int argc, char* argv[]) {
  32.  
  33. Baz baz;
  34. baz.CallBar();
  35.  
  36. }
Success #stdin #stdout 0s 2928KB
stdin
Goo goo gooo!
stdout
Kung ~Foo~!