What's the difference between an object and a struct in OOP?

后端 未结 10 1934
旧时难觅i
旧时难觅i 2021-01-30 09:05
  • What distinguishes and object from a struct?
  • When and why do we use an object as opposed to a struct?
  • How does an array differ from both, and when and wh
10条回答
  •  渐次进展
    2021-01-30 09:27

    By their nature, an object has methods, a struct doesn't.

    (nothing stops you from having an object without methods, jus as nothing stops you from, say, storing an integer in a float-typed variable)

提交回复
热议问题