[问题] c++ class 内部 array size 宣告

楼主: QQrzQQ (QQ)   2018-10-19 16:46:13
#ifndef A_H
#define A_H
#define SIZE 4
class A{
int a[SIZE];
};
#endif
如前面所写的
因为我在使用上呼叫不同标头档
会遇到SIZE重复定义的问题
试着使用const int在class内
却无法compile过
想请问大家如果遇到这种问题
又不想用new的方式
有没有其他建议的写法
谢谢 :)

Links booklink

Contact Us: admin [ a t ] ucptt.com