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; } };
2 odpowiedzi
+ 3
Public
setAge(a)
int
return
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; }