fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class figure
  6. {
  7. };
  8.  
  9. class Pawn : public figure
  10. {
  11. };
  12.  
  13. void value(figure fi)
  14. {
  15. cout << "val typeid check: " << (typeid(fi) == typeid(Pawn)) << endl;
  16. }
  17.  
  18. void refer(figure& fi)
  19. {
  20. cout << "ref typeid check: " << (typeid(fi) == typeid(Pawn)) << endl;
  21. }
  22.  
  23. int main()
  24. {
  25. Pawn p;
  26. value(p);
  27. refer(p);
  28. }
  29.  
  30.  
Success #stdin #stdout 0.01s 5500KB
stdin
Standard input is empty
stdout
val typeid check: 0
ref typeid check: 0