Description: (1) write Master class and add different methods to treat different pets depending on the type of pet input. Write test class validation;
(2) use polymorphism to modify the code to add the method for each pet class. In the host class, a pet method can be retained, and the parameter type is pet type. Write the test class verification output effect as shown. (note: the same reference type, using different instances to perform different operations is polymorphism; Method rewriting is the foundation of polymorphism.
To Search:
File list (Check if you may need any files):
zuoye4
zuoye4\.classpath
zuoye4\.project
zuoye4\.settings
zuoye4\.settings\org.eclipse.jdt.core.prefs
zuoye4\bin
zuoye4\bin\Person
zuoye4\bin\Person\demo1.class
zuoye4\src
zuoye4\src\Person
zuoye4\src\Person\demo1.java