Hiding private data members? (C++)

后端 未结 5 2052
北海茫月
北海茫月 2020-12-13 00:21

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

5条回答
  •  情书的邮戳
    2020-12-13 00:31

    you want to use something like the PIMPL idiom

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

提交回复
热议问题