fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct Punto
  5. {
  6. double x;
  7. double y;
  8. };
  9.  
  10. class Circulo
  11. {
  12. public:
  13. void centro( const Punto&);
  14. void centro( Punto&) const;
  15.  
  16. private:
  17. Punto centro_;
  18. };
  19.  
  20. void Circulo::centro( const Punto& pto)
  21. {
  22. centro_ = pto;
  23. cout << "void centro( const Punto&)" << endl;
  24. }
  25.  
  26. void Circulo::centro( Punto& pto) const
  27. {
  28. pto = centro_;
  29. cout << "void centro( Punto&) const" << endl;
  30. }
  31.  
  32.  
  33. int main()
  34. {
  35. Circulo circ;
  36. Punto pto;
  37. pto.x = 10;
  38. pto.y = 10;
  39.  
  40. circ.centro( static_cast<const Punto&>(pto));
  41. static_cast<void (&)(Punto&)>(circ.centro)( pto);
  42.  
  43. return 0;
  44. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:41:43: error: invalid static_cast from type '<unresolved overloaded function type>' to type 'void (&)(Punto&)'
  static_cast<void (&)(Punto&)>(circ.centro)( pto);
                                           ^
stdout
Standard output is empty