Can C++ struct have member functions?

前端 未结 6 1743
孤街浪徒
孤街浪徒 2021-01-30 13:10

I was pretty confused about the difference between struct and class as I seemed to see them used for pretty much the same things. I googled the differences and the only answer I

6条回答
  •  梦毁少年i
    2021-01-30 14:01

    C++ structs can definitely have member functions. C structs, on the other hand, are a much different beast -- they're essentially arrays that provide names and type information for certain indicies.

提交回复
热议问题