What is a Class and Object in C++?

前端 未结 20 950
走了就别回头了
走了就别回头了 2020-12-09 10:33

What is a Class and Object in C++?

Can we say that a Class is an Object?

相关标签:
20条回答
  • 2020-12-09 11:14

    Class: A class defines a particular type's behaviours and properties.

    Object: An object is an instance of a class.

    For example, if you have a Dog named Bingo.

    • Dog would be the class defining its behaviours and properties

    • Bingo would be an object that is an instance of the Dog class

    Strictly speaking, a Class is not an Object in C++. But in languages such as C# and Java that supports reflection, classes can be used like objects but that is a more advance topic and probaly not what the original question is asking.

    0 讨论(0)
  • 2020-12-09 11:15

    Short Answer: In Languages C++, Java: No. In Languages like Python: Yes

    0 讨论(0)
提交回复
热议问题