Scala inherits thorough actual combat and Spark source code appreciation

1. The parent class is generally abstract or concrete, but the concrete method is not implemented, and the method is implemented in the implementation class.

2. Subclasses can reuse the normal methods of the parent class,

3. If the abstract class of the class wants to inherit the abstract class, the method of the abstract class must be implemented, and the override keyword can be added to the implementation class to verify the method name and parameters

4. Take the parent class type as the initialization variable, and the new subclass type, which embodies the idea of ​​interface-oriented programming. If you want to convert a parent type to a subtype, first the parent class is constructed by the subtype initialization. isInstanceOf and asInstanceOf


Guess you like

Origin blog.csdn.net/superiorpengFight/article/details/54343728