17.10.2 Instance variable initializers

当实例构造函数没有构造函数初始化器或有一个形式为 base(?) 的构造函数初始化器时,该构造函数会隐式执行其类中声明的实例字段的变量初始化器所指定的初始化。这对应于一系列赋值操作,这些操作在进入构造函数时立即执行,并在隐式调用直接基类构造函数之前完成。变量初始化器按它们在类声明中出现的文本顺序执行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

When an instance constructor has no constructor initializer, or it has a
constructor initializer of the form
base(?), that constructor implicitly performs the initializations specified
by the variable-initializers of the
instance fields declared in its class. This corresponds to a sequence of
assignments that are executed immediately
upon entry to the constructor and before the implicit invocation of the
direct base class constructor. The variable
initializers are executed in the textual order in which they appear in the
class declaration.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值