4
Answers

Can't figure out the event workings with my program

Hi

I've gotten further with my program and now need to interconnect the pieces.
My program has many CarRental services, which all can rent cars in and out between them.

Diagram:

I was thinking about the problem and I came up with some ideas. I don't know if they are ok.
One class can have only one event? Is the event way the right way to do this?
There is a CarRentalEventArgs class, which creates the car object, and also has, int rentLenght, owner ID.
This CarRentalEventArgs object is then passed into different methods of the CarRental class, if the ownerID = MyID then the Car is returned by the renter, if the ID's don't match, then it is rented by the same CarRental, that picks up the event.
I am however stuck now. I don't know what to do.
Are there any good tutorials? Or is there some logic to follow?


Answers (4)