HOW TO AFECT A PRIVATE VARIABLE

error: âint Stack<int>::topâ is private
You're probably trying to access the variable directly instead of through a member function.
or else use friend function
how?
The principel of a private variable that it is private so it can be affected from outside the object. Normally, the best solution is to create set- and getfunctions, sometimes it's better to make another class a friend. You can learn more about both ways on the tutorial:http://www.cplusplus.com/doc/tutorial/ (Object Oriented Programming)
Topic archived. No new replies allowed.