Forum Moderators: coopster
For example, a reservation system for a tour company takes reservations for hotels, cars, and flights.
A hotel has rooms, and a room has reservations.
A Car Rental company has cars, and a car has reservations.
A Plane has seats, and a seat has reservations.
There are two ways to model this.
1. Create a generic class Reservation, with child classes Hotels, Cars and Planes. To place a reservation the program calls methods of the class Reservations, which invoke methods in Hotels, Cars and Planes.
2. Create three specific classes Hotels, Cars, and Planes. To place a reservation, the program invokes a method in Hotels, Cars or Planes. Each of these invoke a method in the class Reservations.
Which approach do you recommend, and why?
Thanks.
eg:
Reservations
Hotel
Reservation
[Room Number]
[Name]
[Check In]
[Check Out]
Rental Company
Reservation
[Name]
[Car Number]
[Pickup Time]
[Drop Off Time]
Airline
Reservation
[Name]
[Destination]
[Departure]
[Arival]
[Gate Number]
To extend the example further.
Records
Quantis
Fieldings
[Reg Fielding]
[France]
[US]
[12/12/06 02:30]
[13/12/06 16:45]
[2]
[edited by: Stuperfied at 12:16 am (utc) on Dec. 7, 2006]