in C++, what's the difference between an object and a pointer to an object?

前端 未结 7 553
温柔的废话
温柔的废话 2020-12-30 12:18

In java and objective-c, a variable representing an object is generally a pointer to that object. However, it seems that in C++, it\'s common to have non-pointer types hold

7条回答
  •  时光取名叫无心
    2020-12-30 13:02

    The answers to the questions in your second and third paragraph are both "yes". More specifically, if you pass an object to a function by value, the function will receive a copy of that object (created by the copy constructor).

提交回复
热议问题