'function-style cast' : 作为操作员右侧'.'非法
'function-style cast' : illegal as right side of '.' operator
我已经在我的drawview
类中声明了一个enum:
enum current_shape{line,rect,elli};
在我的主类中,我有一个名为m_view
的drawview
实例。
我尝试这样设置枚举:
m_view.current_shape = line;
我也试过
m_view.current_shape = m_view.line;
如何正确设置这个enum
?
枚举是一种类型。枚举类型称为current_shape
。现在需要一个这种类型的对象。但是,可能应该更改名称,使对象为current_shape
,枚举为shape
:
enum shape { line, rect, elli };
shape current_shape;
现在你可以这样设置你的current_shape
:
m_view.current_shape = drawview::line;
给m_view.current_shape
一个不同的名字,current_shape
在声明后保留为enum类型
相关文章:
- 无法编译 rtmidi 测试 cmidiin.cpp 文件, 非法指令
- <<操作员在下面的行中工作
- 编写代码时C++出现错误:错误 1 错误 C2601:'circle':本地函数定义是非法的
- C++ 与操作员不匹配<<
- 操作员C++的模棱两可的过载
- C++中>>操作员过载时出现问题?
- NaN 上的宇宙飞船操作员
- C++中的移动分配出现问题.非法指令: 4.
- 比根<操作员
- while 循环 c++ 中的非法指令
- SFINAE不能防止模棱两可的操作员过载吗?
- 什么是现实中的"endl"(或任何输出操纵器)?它是如何实现的,它如何与操作员<<一起工
- 为什么"delete"操作员给我访问权限冲突
- 使用 ISdigit 通知任何检测到的非法字符
- 非法,左操作数具有类型 'DWORD [29]'
- 来自 VS C++ 在 Windows 上的非法指令
- 为什么使操作员成为新的专用会打破 std::shared_ptr?
- WinLamb 错误:成员初始化非法
- 在这种情况下是私有的吗?试图使操作员<<过载
- 'function-style cast' : 作为操作员右侧'.'非法