扩展类的构造函数
基类:
class test
{
public:
test(int,int);
private:
int num;
int price
};
test(int a,int b)
{
test::num=a;test::price=b;
}
扩展类:
class stu:public test
{
public:
stu(int,int);
};
扩展类构造函数的实现:
stu::stu(int x,int y ):test(x,y)
{
.....//是不是有错尼?
}
现new 一个stu对象时:
stu * s=new stu(2,3)//这句话为什么有错呢?是不是扩展类的构造函数写错了呢?