超级和子类函数调用 [英] Super and sub classes function calling
本文介绍了超级和子类函数调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试过:
ulu kuk lul
解决方案
因此非常简单:
1.创建一个新的子类
object
2.调用该对象的displayResult
方法:
2.1。打印消息从子类显示
2.2。调用父类的displayResult
方法。
注意:首次创建对象时不执行任何代码,除了由编译器创建的默认构造函数。
stack overflow was cancer. looks like this palce is cancer too. i thought programmers were smart lul.
What I have tried:
ulu kuk lul
解决方案
It is fairly straightforward thus:
1. Create a newsubclass
object
2. Call thedisplayResult
method of that object which:
2.1. Prints the message "Displaying from subClass"
2.2. Calls thedisplayResult
method of the parent class.
Note: no code is executed when the object is first created, apart from the default constructor(s) created by the compiler.
这篇关于超级和子类函数调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文