c语言的访问权限大小,c中构造函数的默认访问权限是什么

如果您没有自己声明构造函数,编译器将始终为您生成一个简单的公共构造函数.它们还将隐式创建公共副本构造函数和副本赋值运算符.

从c标准12.1.5:

If there is no user-declared constructor for class X, a constructor having no parameters is implicitly declared as defaulted. An implicitly-declared default constructor is an inline public member of its class.

12.8.7和12.8.11:

If the class definition does not explicitly declare a copy constructor, one is declared implicitly. […]

An implicitly-declared copy/move constructor is an inline public member of its class.

最后12.8.18,12.8.20,12.8.22:

If the class definition does not explicitly declare a copy assignment operator, one is declared implicitly. […]

If the definition of a class X does not explicitly declare a move assignment operator, one will be implicitly declared […].

An implicitly-declared copy/move assignment operator is an inline public member of its class.

如果您使用的是c 11,则不会始终生成移动构造函数.有关更多信息,请参见第12.8.20节.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值