我有一个这样定义的类(在 wxWidgets 框架中):
class SomePanel : public wxPanel{
public:
...
void SomeMethod(const std::string& id){
pointer->UseId(id);
}
const std::string id = "Text"; // still in public area
...
}
在 pogram 的其他地方,我创建了对该对象实例的引用...
mSomePanel = new SomePanel();
...然后我想这样做
mSomePanel->SomeMethod(mSomePanel->id); // Compiler gives an error saying that
// there is no element named id.
在(的)类中,我可以使用这个成员变量调用相同的方法。问题出在哪里?