Design class to hold multiple instances of other classes?

Since you don't have operations specific to any car, you don't need to derive from Car. Let's assume that you have a Car class that has a Brand property, which is an enum. Then you could design your Customer class like this.

The easiest way is to create a base class for the different types of cars. All your specific cars (Mercedes, BMW) will derive from this. By using a common base class or interface, your Customer class can operate on the specific cars without having any understanding of them specifically.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions