I found a piece of code as the following.
#define READWRITE READWIRTE
#define READWIRTE(varType, varName, funName) \
private: varType varName; \
public: varType get##funName(void) const { return varName; }\
public: void set##funName(varType var){ varName = var; }
READWIRTE(int, mSessionId, SessionId)
I want to know why not defining a function in a normal form. I mean, like this:
private:
int mSessionId;
public:
public int getSessionId() const;
public void setSessionId(int sessionId);
then define these two functions.
When should I use the preprocessor directives?