You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your task is to create a Stack class and extend it's behavior in such a way so that the class is able to count all the elements that are pushed and popped.
Follow the hints:
- Introduce a property designed to count push and pop operations and name it in a way which guarantees it is hidden;
- Initialize it to zero inside the constructor;
- Provide a method which returns the value currently assigned to the counter