At 02:09 AM 5/13/2004, you wrote:
Hi all,
I have a doubt about c++ class properties (maybe it's a little bit
OT!)...Can I define in a class properties that behave like vb or c#
properties, that is not just a simple field but like two routines with the
same name that allow to get / set values? Or have I to define always 2
functions?

Sorry. C++ doesn't have "properties"; it's just not part of the standard language definition.


You can do something similar using proxy objects, however. If you had a class named Book, you could define a method called currentPage() that returned an object of a different type -- BookCurrentPageProperty, for example, that would define a couple of methods:

operator =(int)
operator int()

There's lots of stuff on doing things like this in advanced C++ programming literature. You might want to look at some of the articles at http://www.cuj.com/ to start.

-- Ben Combee, DTS technical lead, PalmSource, Inc.
   Read "Combee on Palm OS" at http://palmos.combee.net/



--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to