JVM的基本规则依然有效:Person的继承类在构造时向基类传递某些内容,而不管语言强调的是什么。
The basic rules of the JVM are still at work: derived classes of Person have to pass something up to the base class when constructed, regardless of what the language insists.
这非常有用,因为它允许特征在不了解实现特征的实际基类将是什么的情况下调用super 。
This is useful because it allows a trait to call super without having to know what the actual base class of the class implementing the trait will be.
子对象多重继承自多个基类,每个基类都有虚函数,那么子类对象的内存布局是什么样的?
A function that is virtual in a base class is implicitly virtual in its derived classes. When a derived class overrides a virtual, the parameters in the base and derived classes must match exactly.
子对象多重继承自多个基类,每个基类都有虚函数,那么子类对象的内存布局是什么样的?
A function that is virtual in a base class is implicitly virtual in its derived classes. When a derived class overrides a virtual, the parameters in the base and derived classes must match exactly.
应用推荐