Hiding members in a C struct

前端 未结 14 2000
渐次进展
渐次进展 2020-11-29 21:02

I\'ve been reading about OOP in C but I never liked how you can\'t have private data members like you can in C++. But then it came to my mind that you could create 2 structu

14条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 21:42

    There are better ways to do this, like using a void * pointer to a private structure in the public struct. The way you are doing it you're fooling the compiler.

提交回复
热议问题