调用默认构造函数 [英] calling the default constructor
本文介绍了调用默认构造函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
class base {
int i;
public:
base()
{
i = 10;
cout << "in the constructor" << endl;
}
};
int main()
{
base a;// here is the point of doubt
getch();
}
base a
和基本a()
?
在第一种情况下,构造函数被调用,第二种情况!
in the first case the constructor gets called but not in the second case!
推荐答案
第二种是声明一个返回基础对象的函数a : - )
The second one is declaring a function a() that returns a base object. :-)
这篇关于调用默认构造函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文