Hiding members in a C struct

前端 未结 14 2034
渐次进展
渐次进展 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:23

    This approach is valid, useful, standard C.

    A slightly different approach, used by sockets API, which was defined by BSD Unix, is the style used for struct sockaddr.

提交回复
热议问题