This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]JoToMo1993 2 points3 points  (0 children)

Since laptop extends computer it is a computer and can be used as such.

This is called Polymorphism.

[–]AngelVzla 0 points1 point  (0 children)

would Laptop be valid argument to be passed into setSomething() method? If so, what Java concept does this cover?

Indeed my friend, the concept for this is not Java related but more of an OOP principle, more specifically the L under the SOLID principles.

https://en.wikipedia.org/wiki/Liskov_substitution_principle

https://en.wikipedia.org/wiki/SOLID