fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. public:
  7. int a;
  8. };
  9.  
  10. class B
  11. {
  12. int b;
  13. };
  14.  
  15. int main() {
  16. // your code goes here
  17. A *aptr = new A;
  18. B *bptr = (B*)aptr;
  19. std:: cout << aptr << ", " << bptr << "\n";
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
0x2b3cb10efc20, 0x2b3cb10efc20