📄 spaceship.h
字号:
// Spaceship.h
class CSpaceship;
//----------class declarations-----------------------------------------------
class CSpaceshipFactory : public CSimulatedCmdTarget
{
public:
CSpaceshipFactory()
{ TRACE("Entering CSpaceshipFactory ctor %p\n", this); }
~CSpaceshipFactory()
{ TRACE("Entering CSpaceshipFactory dtor %p\n", this); }
BOOL ExternalQueryInterface(int lRid, void** ppvObj);
class XClassFactory : public IClassFactory
{
public:
XClassFactory()
{ TRACE("Entering XClassFactory ctor %p\n", this); }
virtual BOOL QueryInterface(int lRid, void** ppvObj);
virtual DWORD Release();
virtual DWORD AddRef();
virtual BOOL CreateInstance(int lRid, void** ppvObj);
} m_xClassFactory;
friend class XClassFactory;
};
class CSpaceship : public CSimulatedCmdTarget
{
private:
int m_nPosition; // We can access these from
// all the interfaces
int m_nAcceleration;
int m_nColor;
public:
CSpaceship() {
TRACE("Entering CSpaceship ctor %p\n", this);
m_nPosition = 100;
m_nAcceleration = 101;
m_nColor = 102;
}
~CSpaceship()
{ TRACE("Entering CSpaceship dtor %p\n", this); }
BOOL ExternalQueryInterface(int lRid, void** ppvObj);
class XMotion : public IMotion
{
public:
XMotion()
{ TRACE("Entering XMotion ctor %p\n", this); }
virtual BOOL QueryInterface(int lRid, void** ppvObj);
virtual DWORD Release();
virtual DWORD AddRef();
virtual void Fly();
virtual int& GetPosition();
} m_xMotion;
class XVisual : public IVisual
{
public:
XVisual() { TRACE("Entering XVisual ctor\n"); }
virtual BOOL QueryInterface(int lRid, void** ppvObj);
virtual DWORD Release();
virtual DWORD AddRef();
virtual void Display();
} m_xVisual;
friend class XVisual; // These must be at the bottom!
friend class XMotion;
friend class CSpaceshipFactory::XClassFactory;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -