What is a Class and Object in C++?

前端 未结 20 960
走了就别回头了
走了就别回头了 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 10:57

    Here is an anology.
    we have a classification called vehicles. Each vehicle will have some properties like :

    • seating capacity
    • fuel capacity
    • fuel consumption
    • type of transmission

    Car, bike, truck, are some instances of vehicles. Each may have different set of properties.
    Here vehicles is a class and all the properties are it's members and car, bike, truck are objects of the class vehicles.

提交回复
热议问题