All pastes #1992405 Raw Edit

Something

public cpp v1 · immutable
#1992405 ·published 2010-11-15 17:54 UTC
rendered paste body
#include<iostream>using namespace std;class Element{	private:		friend class Iterator;		int data;		Element* next;	public:		friend class Dochered;		Element(int a) { data=a; next=0 }};class Dochered{	private:		friend class Iterator;		Element* begin;	public:		Dochered() { begin=0; }		Dochered(Dochered& o);		~Dochered();		Dochered operator =(Dochered&);		friend ostream& operator <<(ostream& f, Dochered& d);		void vstavka(Element e);		void udalit(int i);		int peek();		bool pusto() { return !top; }};class Iterator{	private:		Dochered *O;		Element *cur;	public:		Iterator(Dochered& d) { O=&d; cur=d.top; }		int peek() { return cur->data; }		void next() { cur=cur->next; }		void reset() { cur=D->top; }		Element* current() { return cur; }		Element* isEmpty() { if(!cur) return 0; else return cur; }		void set(Element* p=0) { cur=p}};Dochered::Dochered(Dochered &o){	Iterator it(o);	while(it.isEmpty!=0)	{		vstavka(it.current());		it.next();	}}Dochered::~Dochered(){	Element* e1=top,e2=top;	while(e1!=0)	{		e2=e1->next;		delete e1;		e1=e2;	}}