今日看到了一句话,#define private public瞬间吓尿了。这define好厉害。好迷惑人啊。所有东西都public了。
http://blog.csdn.net/wangjieest/article/details/7978382
C++限制访问数据类型的bug啊。一句话就突破了
关于define与typedefi的区别。一个预处理,一个编译器。以下引自stackoverflow。
#define
is a preprocessor token: the compiler itself will never see it.
typedef
is a compiler token: the preprocessor does not care about it.
You can use one or the other to achieve the same effect, but it's better to use the proper one for your needs
#define MY_TYPE int
typedef int My_Type;
When things get "hairy", using the proper tool makes it right
#define FX_TYPE void (*)(int)
typedef void (*stdfx)(int);
void fx_typ(stdfx fx); /* ok */
void fx_def(FX_TYPE fx); /* error */