I am actually studying for a final examen of my first level of OOP (we use Java), and I need to be conceptually correct in terms of OOP.
So, I have this code:
Light.turnOn(pc);
Light.turnOn(car);
Etc...
And this other one:
pc.turnOn();
car.turnOn();
I have not yet implemented the first one. The second one, I did it like this...
class pc extends Light { ... }
class car extends Light { ... }
Where Light is an abstract class. Each different class, pc and car extends from Light and they implement their own version of the method turnOn(), in each of them.
In the first sample code (which I have not yet implemented), I would have different versions of the method turnOn() (in the same class), without "extending" anything.
So: which of the two codes implements/uses polymorphism? Why? How does the other example does not implement/uses it?
Thanks you in advance.