使用以下代码片段作为我的问题的说明:
// #includes and other macros
class MyClass : public CFormView
{
private:
DECLARE_DYNCREATE(MyClass)
bool privateContent;
...
public:
bool publicContent;
...
};
class MusicPlayer
{
public:
AppClass *theApp; // which has a pointer accessing the MyClass object instantiated in the program
...
}
当我在 MyClass 定义中放置关键字“private”时,当我尝试在 MusicPlayer 类的方法中访问它时,privateContent 成员变量似乎不是私有的。但是,如果我将“private”关键字放在 DECLARE_DYNCREATE(MyClass) 行之后,privateContent 成员变量的行为就会恢复到预期的状态。有谁知道为什么会这样?提前致谢。