Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!ginosko!uunet!mcsun!sunic!ifi!grim.uio.no!torfinna
From: torfinna@grim.uio.no (Torfinn Aas)
Newsgroups: comp.lang.c++
Subject: ********
Message-ID: <2046@ifi.uio.no>
Date: 25 Sep 89 08:20:13 GMT
Sender: news@ifi.uio.no
Lines: 25
Keywords:Link list and this


I have a linkt list class with a next pointer. This pointer is a pointer to
the next node-obj. in the list.

I want to overload the ++ operator, so that by applying ++ to a node-pointer
it will move the pointer to the next element in the list.

This is what I did:  
	void node::operator ++ (){
		this = next;
	}

	node* ptr;
	//... point ptr to list
	(*ptr)++;

This did not advance the pointer ay all. Why not?
I also tried 
	*ptr++; 
but that did not work at all. (because of the precedence I suppose)

Is it not possible to point  to another obj. within the obj.?

Torfinn Aas
UiO, Blindern, Norway