【发布时间】:2014-01-08 11:35:08
【问题描述】:
在类中声明和定义的静态常量变量。如何在同一项目中另一个类的私有访问中访问它。是否可以?
//in some header file
Class A{
public:
//some data
private:
static const uint8_t AVar =1;
//other data
};
//in some another header file
Class B{
static const Bvar;
};
//here inside Class B it possible to give Bvar = AVar ? If yes, How ?
【问题讨论】:
-
请忽略数字 1)、2)、3) 等。
-
friend是你的朋友 :) 但如果可能的话,我会避免这样做。
标签: c++ c++11 static constants