Completeness of C ++ Member Initialization List

should class member initialization lists in C ++ be completed? or can they just initialize one or two of the given element in the class?

early!

+3
source share
3 answers

They do not have to be complete. You can leave the base classes and POD types , which are constructive by default, POD types, however, remain uninitialized.
Obviously, persistent members and links must be initialized in the member initialization list.

+5
source

inthas a constructor, see the Stroustrup section. C ++ programming language. 6.2.8.

int j = int(); 

j 0 ( 0 , , int() 0. , .

+1

, - , , ( ).

, , , . getcha - , float .., , undefined.

0

Source: https://habr.com/ru/post/1756086/


All Articles