// https://www.youtube.com/watch?v=ZHqFrNyLlpA&t=42m14s struct Entity_hot { vec3 position; quat orientation; float scale; } struct Entity_cold { uint32_t flags; char * label; Group * group; } #define ENTITY_MEMBER(STORE, MEMBER) \ decltype(Entity_##STORE.MEMBER) & MEMBER() { return STORE->MEMBER; } \ void & MEMBER(decltype(Entity_##STORE.MEMBER) const & value) { STORE->MEMBER = value; } class Entity { public: ENTITY_MEMBER(hot, position) ENTITY_MEMBER(hot, orientation) ENTITY_MEMBER(hot, scale) ENTITY_MEMBER(cold, flags) ENTITY_MEMBER(cold, label) ENTITY_MEMBER(cold, group) private: Entity_hot * hot; Entity_cold * cold; } class Door : public Entity { // ... }