I have a class field
char chars[4]
I want to init this field in the constructor.
My constructor need to get char chars[] as a parameter and in the constructor call I want to init my class fields.
Can I do it or I need to call copy?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to call copy.
This is slightly risky code since there is no guarantee that param has four characters to copy.