fork download
  1. class B;
  2.  
  3. class A
  4. {
  5. protected:
  6. int a;
  7. public:
  8. operator B*()
  9. {
  10. throw("Bad Type Overload");
  11. }
  12. };
  13. class B:public A
  14. {
  15. protected:
  16. int b;
  17. };
  18. int main()
  19. {
  20. A *a = new A();
  21. B *b;
  22. b=(B*)a;
  23. return 0;
  24. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty