// MACROS
#define A_PROPERTY(TYPE, NAME) \
private: \
TYPE NAME; \
public: \
void SetNAME(TYPE theNAME) {NAME=theNAME;} \
TYPE GetNAME() {return NAME;} \
I am trying to creat a simple Macro that will take a TYPE and a NAME and will create:
- Private member of TYPE named NAME
- Public "getter" method called GetNAME (where NAME is variable...)
- Public "setter" method called GetNAME (where NAME is variable...)
This is how i'd use it from a class definition:
A_PROPERTY(int, Age)
The MACRO works, but creates a "getNAME" method instead of "get(whatever I put in NAME)". It seems MACROS don't parse strings and "parameters" together very well. Is there a way to achieve what I want? or should I just have the method as "NAME" with a different signature to differentiate the get and the set?