c构造函数和析构函数_C ++构造函数,析构函数能力问题和答案(第3集)

c构造函数和析构函数

C ++构造函数和析构函数能力问题列表 (List of C++ Constructor and Destructor Aptitude Questions & Answers)

1) A constructor is called when an object is being created?

1)创建对象时调用构造函数?

  1. True

    真正

  2. False

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个参数)的对象,输出将是什么?

  1. Program will execute successfully

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值