Alex Rivera | Logout

Hiding private data members? (C++)

Asked 2008-10-15T20:22:04.520
47

Is there a way to hide private data members of a C++ class away from its users, in the cpp file? I think of the private members as part of the implementation and it seems a little backwards to declare them in the header file.

Edit
Report

1 Answer

12

you want to use something like the PIMPL idiom

http://en.wikipedia.org/wiki/Opaque_pointer

answered 2008-10-15T20:28:06.847

Your Answer