class类定义示例如下:定义一个书类class book
{
private:
int price; //价格属性
int pages; //页数属性
public:
void ShowPrice()
{ //显示书价格操作
printf("The price of this book is %d",price);
}
void ShowPagas()
{ //显示书页数操作
prinft("The pages fo this book is %d",pages);
}
}; //很容易忽略的细节“;”
|