开发者

Visual C++/CLI (CLR) Null pointer

I wan't to implement the following code - the check if the pointer is null or not null. If the pointer points to object, then do sth with that object, if not - skip that code block.

My code:

ref class EchoClient {
private:
    GameMatrix^ gameMatrix;
public:
    EchoClient(void);
    EchoClient(GameMatrix^);
    void do();
};

EchoClient::EchoClient(void)
{
    this->gameMatrix = NULL;
}

EchoCl开发者_StackOverflowient::EchoClient(gameMatrix)
{
    this->gameMatrix = gameMatrix;
}

void EchoClient::do() {
    if(this->gameMatrix != NULL)
    {
        this->gameMatrix->redrawMatrix();
    }
}

The error:

error C2446: '!=' : no conversion from 'int' to 'GameMatrix ^' k:\visual studio 2010\Projects\EchoClient3WS\EchoClient3WS\EchoClient.cpp    106

Any solutions ???


nullptr

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜