0

can you help me solve this question?

class Student { private: int age: : Student(int a) { setAge( ); } void setAge(int a) { age = a; } getAge() { age; } };

8th Apr 2020, 6:25 AM
Ahmed Ba Haroon
Ahmed Ba Haroon - avatar
2 ответов
+ 3
Public setAge(a) int return
16th Jul 2022, 11:42 AM
Sanjay Leo
Sanjay Leo - avatar
0
In the Student constructor, you will want to pass 'a' to setAge() in order to properly initialize "age", i.e. setAge( a ); and getAge() should return an integer, namely "age", so its definition would be int getAge() { return age; }
8th Apr 2020, 7:15 AM
Shadow
Shadow - avatar