fork download
  1. #include <iostream>
  2. using namespace std;
  3. class Itest{
  4. public:
  5. void fun(){cout<<"hello";};
  6. int aaa;
  7. };
  8. class test:public Itest{
  9. public:
  10. void fun(){cout<<"hello world.";}
  11. int a1;
  12. };
  13. int main(){
  14. test* a=new test();
  15. a->a1=10;
  16. a->aaa=10;
  17. Itest* b=a;
  18.  
  19. test* c=(test*) b;
  20. cout<<c->a1;
  21. return 0;
  22. }
Success #stdin #stdout 0.02s 2856KB
stdin
Standard input is empty
stdout
10