【发布时间】:2017-07-20 01:28:26
【问题描述】:
我的教授今天在黑板上写了一些我看不懂的代码。它似乎是一个派生类构造函数调用一个基类构造函数,但我不确定。如下:
class Base{
int x, y;
public:
Base(int,int);
};
class Derived: public Base{
int z;
public:
//what does the colon and the code following it do here?
Derived(int a):Base(a, a+5){
z = a;
}
};
【问题讨论】:
-
你的怀疑是正确的
-
你可以问教授(或助教)
-
如果你不明白,你应该请你的老师解释。他们获得报酬是为了向您提供所需的信息,并确保您了解所提供的材料。
标签: c++ inheritance