constructor&object 的对比

Constructor vs object

A constructor is a special member function in the class to allocate memory to an object. It can be used to provide values for the data members. The constructor is invoked when the object is created. It has the same name as the class name. A constructor does not return any value.

构造函数与对象

构造函数是类中的特殊成员函数,用于为对象分配内存。 它可用于为数据成员提供值。 创建对象时将调用构造函数。 它与类名具有相同的名称。 构造函数不返回任何值。

原文地址:https://www.cnblogs.com/BigWatermelon/p/9916489.html