dimanche 3 mai 2020

c++ how do you implement a has relationship?

for example: i got great reservations: the class has memeber the start/end date and a function that gives me the date.

class reservation{
    private:
    datetime start;
    datetime end;

    public:
    reservation(stardatetime, enddatetime): start(stardatetime), end(enddatetime)
      {

      }

    std::list<std::string> get_reservation()
      {
        for example: return start; 
        }
    };

and i have a class conference room, which can be booked from one time to another.

  class room{
        private: 
        int room_ID;
        public:
        room(int id):room_ID(id)
          {
          }
       void get_room(){
           return room_id;
           }
        }

that means every room has several reservations. how can i access through a room id via the reservation? if i search for room id 1, the reservation of the room will also be displayed.

Thanks.

Aucun commentaire:

Enregistrer un commentaire