A Important Note

"""

ADVICE: USE CONSTRUCTOR INITIALIZERS

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

In many classes, the distinction between initialization and assignment is strictly a matter of low-level efficiency: A data member is initialized and then assigned when it could have been initialized directly.

More important than the efficiency issue is the fact that some data members must be initialized. By routinely using constructor initializers, you can avoid being surprised by compile-time errors when you have a class with a member that requires a constructor initializer.

"""

How to comprehend it?

these words represents the distinction: the compiler decide the steps ( initialization --->.....---> assignment).

I curiously want to know right now?  what does the initializer do?

In my vision,  the possible process is like this .

(declarate a object (a variable)---> get to know which type ----> dispatch  room in storage media ---> store it.....)

I saw these words from the constructor of Class.

the compile-time is a import concept. For instance, when the program were compiled, the compiler obviously know what should be initialized, the object needs a literal value. the const type or the reference are typical presents So when the classes were compiled,  compiler need to know how to construct a function, which the variable need to be declarated. that maybe the mechanism or principle for compiler.

When we uses class or writes it, it seems necessarily to define a constructor or using default(). the const type and the reference needs more attention for a programer.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值