[問題] 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