【发布时间】:2020-06-02 08:06:53
【问题描述】:
我的老师给了我一个示例代码,但我有点困惑。
class CBook
{
...
pubic:
CBook();
CBook(string Title, string Auther, int Year); // I know this is the constructor
~CBook(); // and this is the destructor
};
想知道CBook();的用法,这行代码真的有必要吗?
谢谢
【问题讨论】:
-
I know this is the constructor不是 the 构造函数,而是 a 构造函数(可以有多个)。所以CBook()也是一个构造函数。 -
@t.niese 好的,会的。谢谢。抱歉,我有 0 个关于对象的概念。
标签: c++ constructor