+ 2
What's wrong in array of parametric constructor
Hi Please refer code below: https://code.sololearn.com/cuhJ1df0oDys Can anyone please help me understand issue of clsTest* p3? what's missing here or it is not at all allowed?
2 ответов
+ 3
look like you want to create an array and each element of array is initialized by clsTest
at line 42 write this
clsTest * p3 = new clsTest[3]{{1},{2},{3}}
delete[] p3
// i think your version is not allowed because we can't initialize pointer with aggregate (multiple values) (just guessing)
check this, 👍
https://code.sololearn.com/c3CSCyzT1vrB/?ref=app
+ 1
Thank you so much... It worked ....
Now tried with unique pointer but again got stuck for unique pointer