Inheritance JACA learning

What is inheritance, which is a class attributes and methods are multiplexed. In order to reduce the amount of code you can use the new class to inherit the properties and methods of non-privatization of the inside of the non-privatization. The new class is called a subclass. Subclasses can have their own properties and methods that subclasses of the parent class is extended.

Subclasses can also use their own way to perform the method of the parent class.

Java's single inheritance is inherited, but multiple inheritance, single inheritance is that a subclass can only inherit from a parent class, multiple inheritance is, for example, A class inherits class B, class B inherits class C. To initialize the parameters of the parent class constructor with the need to use the super keyword.

 

Guess you like

Origin www.cnblogs.com/yindong2019/p/11783570.html