p131 Exercise4.2 E2

(a)

int Stack::size() const{

       Node *p=top_node;

       int count=0;

       while(p!=NULL){

              p=p->next;

              count++;}

       return count;

}

(b)

Void Stack::operator=(const Stack& original)

{

       Stack new_copy(original);

       top_node=new copy.top_node;

}

 

posted @ 2013-09-12 12:23  刘颖斌  阅读(98)  评论(0)    收藏  举报