Q:

Why didn’t we use in-class initializers in PersonInfo

0

Why didn’t we use in-class initializers in PersonInfo?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Because the synthesised default constructor will be called when an object of class `PersonInfo` is created, which will default initialized its data members. Meanwhile, both `string` and `vector` have default constructors, and will be used when default initialized. Thus, we don't need in-class initializers to initialze data members in `PersonInfo`.

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now