fork download
  1. #include<iostream>
  2. #include<stdlib.h>
  3. using namespace std;
  4.  
  5. class Test
  6. {
  7. private:
  8. int x = 134;
  9. public:
  10. Test()
  11. { cout << "Constructor called"; }
  12.  
  13. int get_x(){return x;}
  14. };
  15.  
  16. int main()
  17. {
  18. Test *t = (Test* ) malloc(sizeof(Test));
  19. cout << t->get_x()<< endl;
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
0