can a pointer access a private variable
You'd have to return the pointer (or reference) from within the context of the class though, or someone who has friend access to the class. That is because the variable itself is private and so can't be accessed otherwise. share | improve this answer. answered Jul 4 '10 at 13:11.