struct lineChartScene::lineChartSceneImpl{ enum ContextMenuAction {ShowLabels,ShowPoints,SaveAsImage};};
如何访问lineChartScene :: lineChartSceneImpl结构外的ShowLabels,ShowPoints等?我以为lineChartScene :: lineChartSceneImpl :: ContextMenuAction :: ShowLabels可以工作,但事实并非如此.我正在使用C,Qt Creator 2.2.1.
解决方法struct lineChartScene::lineChartSceneImpl{ enum ContextMenuAction {ShowLabels,SaveAsImage};};
用它作为
lineChartScene::lineChartSceneImpl::ShowLabels
对于您的信息,C++11 also has strong typed enums具有您期望的命名空间语义:
总结06002
The scoping of the enumeration is also defined as the enumeration name’s scope. Using the enumerator names requires explicitly scoping.
Val1
is undefined,butEnum2::Val1
is defined.Additionally,C++11 will allow old-style enumerations to provIDe explicit scoping as well as the deFinition of the underlying type:
06003
The enumerator names are defined in the enumeration’s scope (
Enum3::Val1
),but for backwards compatibility,enumerator names are also placed in the enclosing scope.
以上是内存溢出为你收集整理的c – 访问结构中定义的枚举值全部内容,希望文章能够帮你解决c – 访问结构中定义的枚举值所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)