Hi, guys! I'm new in OOP, so i have some problems here...
I'm doing a model of an elevator. There are three classes: building, elevator(which is located in a building), passenger.
I have a class "building" which contains as a composition another class -"elevator". Class "elevator" has buttons(function-elements) inside, such as: ComeAndGetMe(), TakeMeToLevel(), etc.. So, the class passenger appears on randomized level in the main() program n times(consequently), and by using that buttons transports from level to level.
Question1: for instance, i have two building variables in the main(): b1 and b2. When passenger p1 appears, how can i make it to know in which building it appeared?? I mean, in order to use th buttons each passenger must know the building it belongs to, right?
Question2: If elevator e1 is a composition of a building b1, how can i use buttons of an elevator? b1.e1.TakeMeTo(5)????