Home > Back-end >  Two circle statement in the Java language, please figure how to understand
Two circle statement in the Java language, please figure how to understand

Time:12-21

Two circle statement in the Java language, please figure how to understand ah [face] monkey2:001 PNG [/face] [face] monkey2:001 PNG [/face]

CodePudding user response:

Demonstrate the inheritance, Cupboard is not defined storage () method, why can call? Because of the inherited Chest, Chest with this method, so to subclassing also with this method, and then you can subclass the calling,

CodePudding user response:

That is an example of a polymorphic
Subclasses override the parent class method (the parent class is abstract method), thus changing the behavior of the method (such as storage and c w storage though are inherited abstract methods of the parent, but because the override the methods of treatment, so the behavior is different, w print is chest, c printing is cabinets)
  • Related