>This is not true data abstraction.
Sure it is. The abstraction is the stack and its implementation, not the contents of the stack. Returning a copy of the top of the stack instead of a pointer to it makes no difference in how the stack works. Presumably the question is assuming that a malicious coder can break umpteen language rules to get a hold of other items if given a pointer to one item, but that's equally likely with nothing more than a stack object regardless of how much abstraction you put into it.
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Offline 11,807 posts
since Sep 2004