Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- struct physical_t {
- int mass;
- int radius;
- };
- struct solarBody_t : physical_t {
- float atmosphereDrag;
- unsigned int atmosphereHeight;
- };
- struct ship_t : physical_t {
- float engine;
- unsigned int engineRadius;
- };
- union entity_t {
- physical_t physical;
- solarBody_t solarBody;
- ship_t ship;
- };
- vector <entity_t*> entity;
- int main () {
- entity.push_back (new entity_t);
- entity[0]->mass = 43;
- entity[0]->engine = 16;
- std::cout << entity[0]->mass << endl << entity[0]->engine << endl;
- return 0;
- };
- /*this should output
- 43
- 16
- */
Add Comment
Please, Sign In to add comment