What are the differences between struct and class in C++?

后端 未结 30 3266
盖世英雄少女心
盖世英雄少女心 2020-11-21 05:38

This question was already asked in the context of C#/.Net.

Now I\'d like to learn the differences between a struct and a class in C++. Please discuss the technical d

30条回答
  •  南方客
    南方客 (楼主)
    2020-11-21 06:00

    Here is a good explanation: http://carcino.gen.nz/tech/cpp/struct_vs_class.php

    So, one more time: in C++, a struct is identical to a class except that the members of a struct have public visibility by default, but the members of a class have private visibility by default.

提交回复
热议问题