单文挡多视图显示的一个小问题 GetDocument;
我在制作单文挡多试图显示的一个程序是:
按一本书上的说明先增加了一个视图类CBarView
class CBarView : public CView
{
..............
};
然后按照书上的说明要为CBarView类添加文挡视图的交互函数GetDocument(),得到
class CBarView : public CView
{
..............
Public:
CPROG3Doc * GetDocument(); // CPROG3Doc文挡类
};
CPROG3Doc* CBarView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CPROG3Doc)));
return (CPROG3Doc*)m_pDocument;
}
我在的函数中用
void CBarView::OnDraw(CDC* pDC)
{
CPROG3Doc* pDoc = GetDocument();
.........................................
}
总是出一大堆错误呢?
syntax error : missing ';' before '*'
'CPROG3Doc' : missing storage-class or type specifiers
'GetDocument' : missing storage-class or type specifiers
'initializing' : cannot convert from 'int *' to 'class CPROG3Doc *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
但是 光盘里的例子程序是一样的 却能够正常运行...
各位大侠 帮我看看 先多谢了!!