Constructor and destructor

xiaoxiao2021-03-06  93

The constructor of the class is a function that is automatically executed when the object is created. Generally, the initialization work of the class is generally cherished, and the customer cannot call the function.

The calibratory function is a class of objects in the destruction of the execution, and some of the finishes are placed here, such as release memory, etc., customers cannot call

-------------------------------------------------- -------------

The constructor is used to perform an initialization of the instance of the class, and each class has a constructor, even if you don't declare it. When accessing a class, the system will first perform the statement in the constructor, and the execution of any constructor is implicitly invoked to the default constructor base () provided by the system, and there can be parameters or not. When there is a parameter, the parameters must be transferred when the class is instantiated.

The destructor is used to deal with the resource occupied, and cannot be inherited, and the call cannot be displayed, and the parameters are not accepted, and the value is not returned.

转载请注明原文地址:https://www.9cbs.com/read-98577.html

New Post(0)