fork download
  1. #include <iostream>
  2. using namespace std;
  3. struct Base
  4. {
  5. };
  6. struct D : public virtual Base {};
  7. int main()
  8. {
  9. D* d = new D;
  10. Base * b = static_cast<Base*>(d);
  11. cout << b << endl;
  12. d = NULL;
  13. b = static_cast<Base*>(d);
  14. cout << b << endl;
  15. d = (D*)32;
  16. cout << "d=" << d <<endl;
  17. b = static_cast<Base*>(d);
  18. cout << b << endl;
  19. }
Runtime error #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
0x979d008
0
d=0x20