What does this constructor imply?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does this constructor imply??

class A{ public: A(int i=3):i(++i){} void pri(){cout<<this->i;} the above code has an constructor declared and a colon followed by it with some expressions what do they exactly imply?

30th Nov 2017, 7:52 AM
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹ - avatar
2 Answers
+ 1
They are called member initializers. All it does is initialize the specified member variables to the value contained within the parentheses
30th Nov 2017, 7:59 AM
aklex
aklex - avatar
0
thanx @alex can u say why it has 2 paranthesis?
30th Nov 2017, 1:51 PM
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹
U L Knw Me soon๐Ÿ˜‰๐Ÿ˜‹ - avatar