Why are data members private by default in C++?

后端 未结 5 1262
挽巷
挽巷 2021-02-06 01:23

Is there any particular reason that all data members in a class are private by default in C++?

5条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 02:26

    Because otherwise there would be no difference at all between class and struct?

提交回复
热议问题