关于C++构造函数的一个问题
有类classworker{......}classwaiter:virtualpublicworker{intpan;public:waiter(worker&wk,i...
有类
c lass worker
{
......
}
class waiter:virtual public worker
{
int pan;
public:
waiter(worker& wk,int p=0):worker(wk),pan(p){};
...
}
class singer:virtual public worker
{
...
}
class waitersinger:public waiter,public singer
{
public:
waitersinger(const worker& wt, int v = other) :worker(wt), waiter(wt), singer(wt, v){}
}
想问下对于构造函数
waitersinger(const worker& wt, int v = other) :worker(wt), waiter(wt), singer(wt, v){}
构造函数的参数是他本身的对象是怎么回事,还有waiter(wt)对比构造函数的定义少个参数怎么理解 展开
c lass worker
{
......
}
class waiter:virtual public worker
{
int pan;
public:
waiter(worker& wk,int p=0):worker(wk),pan(p){};
...
}
class singer:virtual public worker
{
...
}
class waitersinger:public waiter,public singer
{
public:
waitersinger(const worker& wt, int v = other) :worker(wt), waiter(wt), singer(wt, v){}
}
想问下对于构造函数
waitersinger(const worker& wt, int v = other) :worker(wt), waiter(wt), singer(wt, v){}
构造函数的参数是他本身的对象是怎么回事,还有waiter(wt)对比构造函数的定义少个参数怎么理解 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询