+ 1
c++ create object
may i know what the difference Example a; Example b = Example();
3 ответов
0
Example a; calls default constructor.
Example b = Example (); this is a value initialization assignment syntax that will help with Most Vexing parse. It will still call default constructor and it will also help with ambiguity i.e if you were to try to do this Example b(); , so by doing Example b = Example (), you avoid ambiguity. Hope it helps.
0
tq..got it
0
You're welcome