|
马上注册,结交更多同行朋友,交流,分享,学习。
您需要 登录 才可以下载或查看,没有帐号?注册
x
我在做 exercises1的 第二步时,CreatePoint这个函数怎样使用,我不会用,总是出错,请指导,谢谢。
相关的原程序如下:
CAAOmtPoint::CAAOmtPoint(double iX, double iY):
CATBaseUnknown(),
_x(iX),
_y(iY)
{
}
HRESULT CAAOmtModelFactory::CreatePoint(double iX, double iY,
CAAIPoint** opiNewCAAIPoint)
{
HRESULT rc = E_FAIL;
*opiNewCAAIPoint = NULL;
// Create the point implementation
CAAOmtPoint* pNewPoint = new CAAOmtPoint(iX, iY);
if(!pNewPoint) {
cout << "CreatePoint(): could not create a CAAOmtPoint" << endl << flush;
return NULL;
}
// Get a CATIPoint on pNewPoint
rc = pNewPoint->QueryInterface(IID_CAAIPoint,
(void**) opiNewCAAIPoint);
if(FAILED(rc)) {
cout << "CreatePoint(): could not obtaine CAAIPoint interface" << endl << flush;
return E_FAIL;
}
pNewPoint->Release();
pNewPoint=NULL;
cout << "I Got a Point...." << endl << flush;
return S_OK;
}
我在使用时,是这样的:
CAAOmtModelFactory * pCreatePointFactory;
pCreatePointFactory =(CAAOmtModelFactory *) new CAAOmtModelFactory();
// 2. Use factory to create a point
CAAIPoint** opiNewPoint=NULL;
rc = pCreatePointFactory -> CreatePoint(20,20,???);
CreatePoint函数的第三个变量是返回值,我应该怎样初始化?
|
|