fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. namespace MyCode {
  5. class Class1 {
  6. public:
  7. void mfunction1(int a) {}
  8. };
  9. class Class2 {};
  10. void function1(int a) {}
  11. }
  12. namespace HisCode {
  13. class Class3 {
  14. public:
  15. void mfunction2(int b) {}
  16. void mfunction1(int a) {}
  17. };
  18. class Class4 {};
  19. void function2(int b) {}
  20. }
  21.  
  22. class OurNewClass : public MyCode::Class1, public HisCode::Class3 {
  23. public:
  24. using MyCode::Class1::mfunction1; // needed for disambiguation
  25. void function3() {};
  26. };
  27.  
  28. int main () {
  29. using MyCode::function1;
  30. OurNewClass thing;
  31. function1(2);
  32. thing.function3();
  33. thing.mfunction1(10);
  34. thing.mfunction2(20);
  35. return 0;
  36. }
  37.  
  38.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Standard output is empty