Six default constructors in C++ (introduced)

Table of Contents of Series Articles

  • introduce
  • Constructor
  • destructor
  • copy constructor
  • Assignment overloading
  • Ordinary object address overloading and const object address overloading

introduce

class Date{
    
    };

For example, in the date class above, we have not defined any member variables and member functions in the class. Such a class is called an empty class . But is there nothing in the empty class? No, even if no members are defined in the class, the compiler will generate the following six default member functions :
Six default member functions
In this series of articles, we will introduce these six default member functions in turn.

Supplementary concepts:
Empty class: If there are no members in a class, the class is called an empty class.
Default member function: a member function that is automatically generated by the compiler if the user does not implement it explicitly.

Guess you like

Origin blog.csdn.net/weixin_63614711/article/details/130608129