Assuming i have a class Student that have the following member variables:
an Object can be a pen, a pencil or a block notes and so on...
now i push several object into the Student Objects vector...
How can i access the object from whitin the main?
If i try in a loop to cycle through all the Student Objects i get this error:
error: 'std::vector<CObject> Student::My_Objects' is private|
that sounds correct, cause, as the error say, std::vector<CObject> Student::My_Objects' is private.
What should i do to access this member variable correctly?
Make it public, or should i create a public function that returns the vector?
What is the best practice for this?
Thank you in advance.