在对视图类进行构造时,对该类的m_Document,m_pWndParent进行赋值,m_pWndParent的父窗口为无,而m_Document的值为标志该视图的一个地址值
.
.
解决方案 »
- 绝世高手请进:解决窗口外光标的设置
- 能够实现这样的连接吗??
- ODBC连接Oracle数据库问题(急)
- 请问如何用vc更改DNS设置?
- mfc 能否开发基于DIRECTSHOW的控件?送200分
- 很简单的函数参数的问题。没分了,那位好心人帮忙看看!
- 弄不明白,详情http://expert.csdn.net/Expert/topic/2078/2078080.xml?temp=.6914484
- 向大家请教如何实现将ListCtrL中的数据实现预览与打印?100分相送
- Slider控键为何创建不起来?
- 为何打不开?
- 两个类之间的变量赋值
- 再也研究不下去了..我只要两个简单的socket例子,100分酬谢
CWbView::CWbView()
{
m_Document=(CWnd*)this;
m_pWndParent=NULL;
}
你可以认为他们是相同的。
Initializing Member Objects
Classes can contain member objects of class type, but to ensure that initialization requirements for the member objects are met, one of the following conditions must be met: The contained object’s class requires no constructor.
The contained object’s class has an accessible default constructor.
The containing class’s constructors all explicitly initialize the contained object.
The following example shows how to perform such an initialization:// Declare a class Point.
class Point
{
public:
Point( int x, int y ) { _x = x; _y = y; }
private:
int _x, _y;
};// Declare a rectangle class that contains objects of type Point.
class Rect
{
public:
Rect( int x1, int y1, int x2, int y2 );
private:
Point _topleft, _bottomright;
};// Define the constructor for class Rect. This constructor
// explicitly initializes the objects of type Point.
Rect::Rect( int x1, int y1, int x2, int y2 ) :
_topleft( x1, y1 ), _bottomright( x2, y2 )
{
}
The Rect class, shown in the preceding example, contains two member objects of class Point. Its constructor explicitly initializes the objects _topleft and _bottomright. Note that a colon follows the closing parenthesis of the constructor (in the definition). The colon is followed by the member names and arguments with which to initialize the objects of type Point.Warning The order in which the member initializers are specified in the constructor does not affect the order in which the members are constructed; the members are constructed in the order in which they are declared in the class.Reference and const member objects must be initialized using the member initialization syntax shown in Syntax in Initializing Bases and Members. There is no other way to initialize these objects.