From: Robert Klemme Date: 2003-05-13T20:11:38+09:00 Subject: Re: State Pattern Implementation "Simon Strandgaard" <0bz63fz3m1qt3001@sneakemail.com> schrieb im Newsbeitrag news:pan.2003.05.13.11.04.00.160567@sneakemail.com... > On Tue, 13 May 2003 10:11:42 +0200, Robert Klemme wrote: > > > I'd like to hear what people think: is this a reasonable implementation of > > the state pattern? > > You are representing each state by a number... with the State pattern > isn't each state supposed to be represented by a class ? Normally, yes. The association with a number is just for the ease of keying the example in. My main idea was to replace the state instance by a redefinition of instance methods. Pro is, you safe an instance and a redirection; on the con side is increased code size for the class since you have to include code for all states. I'm curios to know whether anybody did this before. I might be missing some grave disadvantage. Regards robert