当前位置: 技术问答>java相关
how to call parent's methods in a son class?
来源: 互联网 发布时间:2015-04-02
本文导语: a son class extends a parent class, and a method overriding a parent's one. because of the methods' overriding, I can visit the son's method instead of the parent one. this is important for inheritance. But how can I can a parent method which...
a son class extends a parent class, and a method overriding a parent's one.
because of the methods' overriding, I can visit the son's method instead of the parent one. this is important for inheritance.
But how can I can a parent method which is been overriden?
Thanks. (maybe sometimes it is meaningful.)
because of the methods' overriding, I can visit the son's method instead of the parent one. this is important for inheritance.
But how can I can a parent method which is been overriden?
Thanks. (maybe sometimes it is meaningful.)
|
in C++, you can do:
#include
using namespace std;
class Parent {
public:
virtual void method (int i) {
cout
#include
using namespace std;
class Parent {
public:
virtual void method (int i) {
cout