Why not initializer list ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why not initializer list ?

Hi If initializer list is defined, it is first chosen over constructor Why I am not getting initializer list called for c3 object ? https://code.sololearn.com/cfazIOYh3MQ5/?ref=app

7th Jul 2022, 7:36 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Answer
+ 5
The initializer list constructor have precedence over other ctors only when initializer syntax is used.... If you initialize c3 like C c3{4}; the inizializer list ctor will be called
7th Jul 2022, 8:25 PM
KrOW
KrOW - avatar