Java polymorphism in the end what does this mean? -sunziren

  Before we get started, please remember these words: parent references to subclass objects.


  Question 1: What is polymorphism?

  A: a polymorphic method on a similar parent class, the different subclasses rewriting become different implementations; or polymorphism on a similar two classes, are implemented with a method interface, but the specific implementation of the internal, but not the same.

  For example: The printer has a print function, but let's break out the color printer is in color, black and white is black and white printer to break out, they both realize the printing function, but playing out of different colors.

  For example: have a chat messaging software, but the computer version of QQ account password can log in, micro-channel version of the computer code can only log on to sweep the phone, they both realized the chat function, but different means login.

  It will feel like polymorphism, eventually we realized the functional requirements of the development of the document, but the details, strengths and weaknesses compared to the original document.

  Question 2: Why do we need a multi-state?

 

Guess you like

Origin www.cnblogs.com/sunziren/p/11481940.html