// ================================================ ==================================================================== // Name: 5.1.cpp // Author: Zhaoming // version: // copyright: copyright to Zhaoming // Description: Hello world in C ++, ANSI-style // ========================================== ========================================================== = // In C ++, 5.1 is incorrect. # include <iostream> using namespace STD; class list {int value; list * Next; static list * head; // declare the static data member public: List (INT value );~ List () ;}; list * List: Head = 0; // defines and initializes the static data member list: List (INT v) {value = V; next = head; head = This;} List ::~ List () {list * P = head; If (Head = This) {head = This-> next;} else {While (p-> next! = NULL & P-> next! = This) // When the second destructor of B is called, P is null. P = p-> next; P-> next = This-> next;} cout <"<this-> value <" ";}int main () {List A (1); List B (2); List C (3); // B. ~ List (); // After the call is displayed, it will be called once by default, resulting in an error Return 0 ;}