Phase 1 Language Basics + Advanced _1-3-Java language senior _02- inheritance and polymorphism _ Section 1 _2_ inherited inherited format

Understanding the code inherited format

to create a parent class

subclassed Teacher


Teacher can call the parent class's method


to view operating results



to create a teaching assistant classes inherit staff ,, class, the same content inside is left blank

assistant


美[əsɪstənt]
英[əsɪst (a) nt]

  • . N Assistant; Assistant; Assistant Professor (college students studying abroad, Professor native language)
  • . Adj assistant; pair
  • Network salesman; auxiliary; salesperson

Assistant create objects, call the parent class's method

can also be run


so that the two subclasses reuse the parent class. To the effect multiplexing method





 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11209740.html