What is a Class and Object in C++?

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

What is a Class and Object in C++?

Can we say that a Class is an Object?

20条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 11:02

    No, an object is an instance of a class...

    Unless...

    If you are implementing a software design tool that allows you to represent classes, interfaces, properties, inheritance, associations, aggregations, etc., then at runtime, yes, each class you place in the designer will be an object instance of the Class class. Ok, couldn't help myself finding an example so twisted and meta.

    Now seriously, a class is not an object.

提交回复
热议问题