fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class BaseEntity {int x;};
  5. //class Entity {int x;};
  6. class EmptyPawn {int x;};
  7. class WeaponEntity {int x;};
  8. class WalkingEntity {int x;};
  9. class IntelligentEntity {int x;};
  10. class PlayerCharacter {int x;};
  11. class StaticMesh {int x;};
  12.  
  13. union union_base {
  14. BaseEntity baseEntity;
  15. Entity entity;
  16. EmptyPawn emptyPawn;
  17. WeaponEntity weapon;
  18. WalkingEntity walkingEntity;
  19. IntelligentEntity intelligentEntity;
  20. PlayerCharacter playerCharacter;
  21. StaticMesh staticMesh;
  22. };
  23.  
  24. int main() {
  25. // your code goes here
  26. return 0;
  27. }
Compilation error #stdin compilation error #stdout 0s 4184KB
stdin
Standard input is empty
compilation info
prog.cpp:15:1: error: ‘Entity’ does not name a type; did you mean ‘BaseEntity’?
 Entity entity;
 ^~~~~~
 BaseEntity
stdout
Standard output is empty