T
Tarren
Hi:
I am writing a public function as part of a class and wanted to inquire as
to what is common practice to the following scenario.
I have a class called CARDEALERSHIP
i have two classes USEDCAR and NEWCAR both of which inherit CAR class
For the dealership, I have a property called INVENTORIEDCARS which returns
an ArrayList
since this inventory contains both USEDCAR objects and NEWCAR objects, would
i have the arraylist have objects of both types?
Then when I call an item in the arraylist, I would have to check the type
and carry out logic based on that?
How have people dealt with a scenario such as this?
Thanks all!
I am writing a public function as part of a class and wanted to inquire as
to what is common practice to the following scenario.
I have a class called CARDEALERSHIP
i have two classes USEDCAR and NEWCAR both of which inherit CAR class
For the dealership, I have a property called INVENTORIEDCARS which returns
an ArrayList
since this inventory contains both USEDCAR objects and NEWCAR objects, would
i have the arraylist have objects of both types?
Then when I call an item in the arraylist, I would have to check the type
and carry out logic based on that?
How have people dealt with a scenario such as this?
Thanks all!