What's wrong in copy constructor [solved] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's wrong in copy constructor [solved]

Hi All I am trying to implement one good practice project our fellow community member has posted. It is yet half cooked. Please find below for same: https://code.sololearn.com/c1gCRHFwAaGG I am facing issue why s_s1.size() is not 2 from function tryString()?

2nd Mar 2021, 5:02 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Answers
+ 3
Because you made m_intSize static. s_s is clearing it from s_s1 as well when you call clear.
2nd Mar 2021, 5:28 PM
Dennis
Dennis - avatar
0
Thanks 😊... I just got concerned that my copy constructor is having issue and missed this class scope data member...
2nd Mar 2021, 5:50 PM
Ketan Lalcheta
Ketan Lalcheta - avatar