I was asked to describe the relationship between vehicle, car, toyota in object oriented programming term (let’s say in php environment). I was stumped. Can someone help me about it? Thanks…
I was asked to describe the relationship between vehicle, car, toyota in object oriented
Share
A car is a vehicle and a toyota car is a car.
The most straightforward statement is that
carcould be a subclass ofvehicleand atoyota carcould be a subclass ofcar.Of course,
Toyotacould also refer to the company, in which case things would be a little different. I’m pretty sure the paragraph above is what they expected to hear, though.