문제

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?

도움이 되었습니까?

해결책

Obviously MessengerEx subtypes the interface Messenger which is sub-type polymorphism.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top