C++教程:C++拷贝构造函数

2020-01-06 12:16:55刘景俊

   cout <<"请输入一个整数和一个字符:" <<endl;
   cin >>tempi >>tempc;
   Linklist a(tempi,tempc);
   a.Locate(tempi);
   a.Insert(1,'C');
   a.Insert(2,'B');
   a.Insert(3,'F');
   cout <<"After Insert" <<endl;
   a.Show();
   a.Locate('B');
   a.Delete();
   cout <<"After Delete" <<endl;
   a.Show();
   Linklist b(a);//创建一个链表b,并且将链表a复制到链表b
   cout <<"This is Linklist b" <<endl;
   b.Show();//显示b链表中的内容
   a.Destroy();
   cout <<"After Destroy" <<endl;