C++: When should I use structs instead of classes and where are the speed differences?

前端 未结 5 688
别跟我提以往
别跟我提以往 2021-02-02 10:42
  • When should I use a struct instead of a class? I\'m currently using classes for everything from OpenGL texture wrappers to bitmap fonts.

  • Is

5条回答
  •  囚心锁ツ
    2021-02-02 11:21

    1) There is no real difference between the 2 other than the fact that struct members are, by default, public where classes are private.

    2) No its EXACTLY the same.

    Edit: Bear in mind you can use virtual inheritance with structs. They are THAT identical :)

提交回复
热议问题