Function, Structure, Class | Dialog

xiaoxiao2021-03-06  46

Structure: A structure is a data type that synthesizes other data types to a separate user-defined type. Class: A class allows data and function bundle together and uses a function as a separate element. It is often referred to as a method. A class instance, sometimes called an object, an event of a class. An instance in the class can be used in your program. Class pair instance: Class is a description of an object; An example of a class is a specific class. Constructor: When a class object is created, a constructor is a special member function that is created. The constructor is always the same name and never There is no return value, not a void. The purpose of constructor is to place the active object in a known state. Typically, constructor can allocate system resources, clear, or set variables, or perform some other initialization Type. Write this, I have a destruct: is a special member function, which is called a destructor because it seems to undermine the object, the destructive function is defined to have no return value. And there is no statement of a parameter list. The name of the destructor is the name of this class, and uses a top line ~ as a prefix. Wake up a destructive function is not very necessary, unless a special task must be The object is executed, for example, the assigned system resource parsive function must be released.

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

New Post(0)