fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Cat
  5. {
  6. static void play(int value)
  7. {
  8. std::cout << "cat plays with int " << value;
  9. }
  10.  
  11. static void play(std::string value)
  12. {
  13. std::cout << "cat plays with string " << value;
  14. }
  15. };
  16.  
  17. struct Dog
  18. {
  19. static void play(Dog &value)
  20. {
  21. std::cout << "cat plays with dog";
  22. }
  23. };
  24.  
  25. int main() {
  26. // your code goes here
  27. Cat cat;
  28. Dog dog;
  29. //cat.play(1);
  30. cat.play(dog);
  31. return 0;
  32. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:30:14: error: no matching function for call to ‘Cat::play(Dog&)’
  cat.play(dog);
              ^
prog.cpp:6:14: note: candidate: static void Cat::play(int)
  static void play(int value)
              ^~~~
prog.cpp:6:14: note:   no known conversion for argument 1 from ‘Dog’ to ‘int’
prog.cpp:11:14: note: candidate: static void Cat::play(std::__cxx11::string)
  static void play(std::string value)
              ^~~~
prog.cpp:11:14: note:   no known conversion for argument 1 from ‘Dog’ to ‘std::__cxx11::string {aka std::__cxx11::basic_string<char>}’
stdout
Standard output is empty