Not Relevant: Psst, hey, don't follow the OOP hole; it's scary
Super Relevant: ..psst, try this
(0) let's suppose we have a Data Structure named BUFFER
(1) the first container in BUFFER is a
Code:
vector<uint32_t> _id_
(1.1) _id_ contains all the passengers ids; Attention: All ids are unique, like all people on this earth.. and all ids are natural numbers (e.i 1,2,3,4,..).
(1.2) _id_ is the most trivial and important container in BUFFER
(1.3) every new passenger gets a new id; if for some
Code:
n >= 0, if (_id_[n] <= 0) is true
then the nth passenger does not exist.
(2.) Every passenger has a known/fixed number of features like the ones you mentioned (they could have more). These features are: age; phone number; ACTUAL id number; flight "something"; "has the passenger arrived yet"; "how many cpu cycles did he skip due to his inability to recognize the presence of a well established dogma" (passive aggressive OOP vs DOD pun); The number of bags he brings; etc. NOTICE that all of these features are addressable via native types (unsigned int, int, bool(C doesn't like these), and more);
(2.1) The next part is to create a container for each feature of type passenger feature type that we want to address.
very Pseudo-code
Code:
BUFFER{
Vec<uint32> _id_;
/*containers with the passenger features */
Vec<uint32> _planeID_;
Vec<uint8> _numBags_;
.
.
}
In a short schema:
Code:
for some n >= 0
_id_[n] : id of nth passenger
_numBags_[n] : number of bags the nth passenger brings
_planeID_[n] : the id of the aircraft the nth passenger was assigned to
, provided that (_id_[n] > 0) is true
You could also have an AIRCRAFT_BUFFER with the same formatting.
I mean, this is one way of Designing your structures of data before you start filling anything with eternal loops of iterators; I like this way a lot. This was the first thing that came out of the top of my head.. hope i could've helped with the designing part. stay safe; stay oop minimal.