Like everyone else, the main difference is the default protection level (i.e., open or closed). However, this is also a good sign of the actual use of the data structure. For example, sometimes you may need a lightweight structure similar to a java bean. In this case, you can simply:
struct point { float x, y; };
It is clear that you are not using any C ++ features here, compared to:
class point { public: float x, y; };
It is less clear what your intention is. Probably the second example I would call bad code, because someone did not provide recipients and setters.
source share