c构造函数和析构函数
C ++构造函数和析构函数能力问题列表 (List of C++ Constructor and Destructor Aptitude Questions & Answers)
1) A constructor is called when an object is being created?
1)创建对象时调用构造函数?
Answer & Explanation 答案与解释
Correct Answer: 1
正确答案:1
True
真正
No matter, you have created constructors or not in the class, if there is no constructor created by you, constructors are added to the class and when we an object is being created constructor gets called.
没关系,您是否在类中创建了构造函数,如果您没有创建构造函数,则会将构造函数添加到类中,并且在我们创建对象时会调用构造函数。
2) If you created a parameterized and a copy constructor in the class and you create an object with no arguments (0 arguments), what will be the output?
2)如果您在类中创建了参数化和副本构造函数,并且创建了不带参数(0个参数)的对象,输出将是什么?