What is exactly an object in C++?

前端 未结 5 1269
花落未央
花落未央 2020-12-17 20:33

In the beginning of my journey learning C++, I thought an object is an OOP-only related term. However, the more I learn and the more I read, I can see that this not the case

5条回答
  •  醉梦人生
    2020-12-17 21:28

    In C++ world, an object is the instantiation of a class. It behaves (methods/functions) in certain ways and has attributes (data members) that depicts its state.

    An object has lifetime. It is created (through constructor), it lives, and it dies (through destructor).

    A class is like a blueprint, through which you define the behavior and attribute of an object.

提交回复
热议问题