1. This is a C++ program, with a main entry function and a class test;
2. The class test has three member functions of public access type: show( ), set(), test(), where ~test() is the destructor of the class and is explicitly declared. Each class has a corresponding constructor and destructor. If they are not written out, use The default constructor and destructor, the constructor of this class uses the default one, and according to the code test t; it can be seen that the default no-argument constructor is called;
3. Class test has Two private (that is, private) access type member variables: num (int integer), name (string string), since they are both modified with the static keyword, it means that these two private member variables are static, that is, they can only Declared within the class, initialized outside the class, and can be accessed by the static and non-static member functions of the class;
4. The green part within the class, which is the private access part of the class, is the two A declaration of static type data members, and the green part outside the class is exactly their definition. C++ stipulates that static data member variables of a class must be declared within the class, defined and initialized outside the class, and "class" must be added before the variable name. Name::" format prefix, this class is only defined outside the class and is not initialized. Standard coding rules are best defined and initialized at the same time;
5. Class test is defined in main An object, and at the same time implicitly calls the default no-argument constructor of the class (the so-called default means that the compiler automatically implements it, and the user does not explicitly implement it), and then calls the set() member function of the class object t to set the class Assign values ??to two static private data members, and finally call the show() function of object t for display output;
6. Completed, hope you adopt it, typing is not easy, it should be detailed enough.