fork download
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. struct Widget
  7. {
  8. int widget;
  9. };
  10.  
  11. struct Button
  12. : public Widget
  13. {
  14. int button;
  15. };
  16.  
  17. int main()
  18. {
  19. Button* b = new Button;
  20. cout << b << endl;
  21. Widget* w = static_cast<Widget*>(b);
  22. cout << w << endl;
  23. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
0x55fa1bfb6c20
0x55fa1bfb6c20