I was told there are multiple situations in which initialization list must be used to for initialization.
There are three cases
1) const member
2) reference
3) members without default constructors
Is that right? Anyone would like elaborate this? Is there any other case I missed?
Thanks!
…or POD class types or arrays of POD class types that directly or indirectly themselves contain a const-qualified member. But yes, yours are the main cases.
For your (3), this only applies if there are user-declared constructors other than a default constuctor. If there are no user-declared constructors at all then the member can be default initialized if it isn’t mentioned in the initializer list.