C++教程:C++静态成员函数

2020-01-06 12:21:21丽君

   Linklist a(tempi,tempc);
   a.Locate(tempi);
   a.Insert(1,'C');
   a.Insert(2,'B');
   cout <<"After Insert" <<endl;
   a.Show();
   cout <<"Node Allocation:" <<Node::allocation() <<endl;//调用静态成员函数
   Node b;
   cout <<"An independent node created" <<endl;
   cout <<"Node Allocation:" <<b.allocation() <<endl;//调用静态成员函数
   return 0;
}

运行结果:
请输入一个整数和一个字符:
3 F
Node constructor is running...
Linklist constructor is running...