fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A {
  5. public:
  6. A() {}
  7. };
  8.  
  9. class B : A {
  10. public:
  11. B() {}
  12. };
  13.  
  14. void f(A a, B b) {
  15. cout << "A, B" << endl;
  16. }
  17.  
  18. void f(A a, A b) {
  19. cout << "A, A" << endl;
  20. }
  21.  
  22. void f(B a, A b) {
  23. cout << "B, A" << endl;
  24. }
  25.  
  26. void f(B a, B b) {
  27. cout << "B, B" << endl;
  28. }
  29.  
  30. int main() {
  31. A a;
  32. B b;
  33. f(a, b);
  34. f(b, a);
  35. f(a, a);
  36. f(b, b);
  37. return 0;
  38. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
A, B
B, A
A, A
B, B