Obviously MessengerEx
subtypes the interface Messenger
which is sub-type polymorphism.
If you had to point to polymorphism, which line would it be? [closed]
-
30-06-2023 - |
Question
So, lets say we have a couple of classes:
First one is interface class, called "Messenger".
In the second class "MessengerEx", we inherit "Messenger" interface and realize its methods.
And also, we have "main" class.
Lets say that main looks like this:
// initialization of main class`
Messenger messengerEx = new MessengerEx();
system.out.println(messengerEx.getSomeMessage());
// ending main
If someone asked you to point where polymorphism in this program is, where would you point?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow