0
how to output in main()?
class Student{ private: int age; public: Student(int a){ setAge(a);} void setAge(int a){ age = a;} int getAge(){ return age;}};
2 Answers
+ 2
DarkEye create object of class and call method as below :
Student obj(21);//object created for a class
cout << obj.getAge(); // get value of age using method call from object
+ 1
thank youđ



