fork(1) download
  1. #include <iostream>
  2. #include <typeinfo>
  3. using namespace std;
  4.  
  5. class vvoid {
  6. virtual void mv() {};
  7. };
  8. class Name
  9. {
  10. virtual void mv() {};
  11. int a;
  12. int b;
  13. };
  14.  
  15. class Name1
  16. {
  17. virtual void mv() {};
  18. int a;
  19. int b;
  20. };
  21.  
  22. void f(vvoid *p){
  23. cout<<"f("<<p<<"):"<<typeid(*p).name()<< endl;
  24. }
  25.  
  26. int main() {
  27. Name *n=new Name;;
  28. Name1 *n1=new Name1;
  29. f(reinterpret_cast<vvoid*>(n));
  30. f(reinterpret_cast<vvoid*>(n1));
  31.  
  32. // your code goes here
  33. return 0;
  34. }
Success #stdin #stdout 0s 3228KB
stdin
Standard input is empty
stdout
f(0x879b008):4Name
f(0x879b018):5Name1