QQ神奇:你的虽然你传递了形参,但是在你的函数中却没有使用,而是直接用了Worker("Jim"),Children(20)中的实参
class ChildLabourer : public Worker,public Children
ChildLabourer(string name, int age):Worker(name),Children(age)
// 使用new关键字创建童工类对象
ChildLabourer *cl = new ChildLabourer("jack",10);
// 通过童工对象调用父类的work()和play()方法
cl->work();
cl->play();
// 释放
delete cl;
cl = NULL;
ChildLabourer(string name, int age):Worker(name),Children(age)
// 使用new关键字创建童工类对象
ChildLabourer *cl = new ChildLabourer("jack",10);
// 通过童工对象调用父类的work()和play()方法
cl->work();
cl->play();
// 释放
delete cl;
cl = NULL;