大家好,我是c++新手,有些不懂的地方想请教一下
#include "stdio.h"class CBook
{
public:
char m_BookName[128];
const unsigned int m_Price;
int m_ChapterNum;
CBook()
:m_Price(32),m_ChapterNum(15)
{
strcpy(m_BookName,"大学英语");
printf("构造函数被调用\n");
}
CBook(const CBook &book)
:m_Price(book.m_Price)
{
m_ChapterNume=book.m_ChapterNum;
strcpy(m_BookName,book.m_BookName);
printf("复制构造函数被调用\n");
}
}
void OutputBookInfo(CBook book)
{
printf("%s\n",book.m_BookName);
}
int main(int argc,char* argv[])
{
CBook book;
OutputBookInfo(book);
return 0;
}
运行出错!
老是提示这个错误:'CBook' followed by 'void' is illegal (did you forget a ';'?)
高人指点下。谢谢了!