I'm trying to make a macro to make it easier to define properties.
Simplified example but at the moment I have this to provide a property with a public get and private set:
#define propertyRO(xxType, xxName)\
property xxType xxName\
{\
xxType get() {return m___##xxName;}\
void set(xxType value) {m___##xxName = value;}\
}\
private:\
xxType m___##xxName;\
and then to use it you would do this:
public ref class Wawawa
{
public:
int bob;
propertyRO(String^, MyName);
};
This would potentially work great, but it's flawed because the member is specified in private scope, which means anything that occurs after the macro also gets private scope. e.g:
public ref class Wawawa
{
public:
int bob;
propertyRO(String^, MyName);
int fred; //ERROR HERE <- this would be private not public
};
So if you ignore what this macro actually does, my real question is: is there any way to use the private:
keyword in a macro, without it affecting the rest of the class?