void CProcess::SetCurrentChannel(int currentChannel)
{
int m_crtChannel=currentChannel; //此处重定义,但由于类私有变量m_crtChannel和此处的m_crtChannel不是在一个作用域中,进而编译通过。
}
class
{
...
public:
int m_crtChannel;
...
}
导致的问题是,m_crtChannel的作用域仅限于成员函数SetCurrentChannel中。
m_processOne->SetCurrentChannel(1);
即使设置了m_crtChannel,后面使用的时候也是无效的。
应去掉成员函数中的int。
{
int m_crtChannel=currentChannel; //此处重定义,但由于类私有变量m_crtChannel和此处的m_crtChannel不是在一个作用域中,进而编译通过。
}
class
{
...
public:
int m_crtChannel;
...
}
导致的问题是,m_crtChannel的作用域仅限于成员函数SetCurrentChannel中。
m_processOne->SetCurrentChannel(1);
即使设置了m_crtChannel,后面使用的时候也是无效的。
应去掉成员函数中的int。