"Steve Vallee" <svallee@xxxxxxxxxxxxxx> wrote on 08.02.02 23:42:04: > >> What a poor solution! This is a much nicer one: >> int &property() { return mProperty; } >> So you can do >> x = property(); >> and >> property() = x; > > >Oups ! In my previous mail I forgot to tell that your exemple doesn't work >for what I'm searching for. Let's stick with the Width property example. > >- You have a private variable that contain the value ( fWidth ) >- You have a SetWidth( int ) function that set the value, do some error >checking, and redraw the object on screen. > >Then you can have a property like this : > >_property Width = { read = fWidth, write = SetWidth }; > >So : > >Width = x; // equal SetWidth(x); >x = Width; // equal x = fWidth; (bypassing the private nature) > > >- Steve Granted, the above solution is of limited use, also because you often don't return the same type you work with internally. It was just a reaction to the simple "int property() { return int }" example. Michael Noisternig