C++教程:C++继承的实现和方式

2020-01-06 12:33:19丽君

bool Delete();
void Show();
void Destroy();
protected://原私有成员改为保护成员,以便于Stack类继承
Node head;
Node * pcurrent;
};
Linklist::Linklist(int i,char c):head(i,c)
{
cout<<"Linklist constructor is running..."<<endl;
pcurrent=&head;
}
Linklist::Linklist(Linklist &l):head(l.head)
{
cout<<"Linklist Deep cloner running..." <<endl;
pcurrent=&head;
Node * ptemp1=l.head.next;
while(ptemp1!=NULL)
{
Node * ptemp2=new Node(ptemp1->idata,ptemp1->cdata,pcurrent,NULL);