构造函数函数的初始化列表
#include <iostream>
using namespace std;
class CDate
{
public:
//“CDate”: 没有合适的默认构造函数可用
CDate(int y, int m, int d)//自定义了构造函数
{
_year = y;
_month = m;
_day = d;
}
void show()
{
cout << _year << "/" << _month << "/" << _day << endl;
}
private:
int _year;
int _month;
int _day;
};
class CGoods
{
public:
CGoods(const char *n,int a,double p)