Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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;
}

EchoClient::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 ???

like image 801
ozzWANTED Avatar asked Oct 15 '10 11:10

ozzWANTED


1 Answers

nullptr

like image 168
leppie Avatar answered Nov 10 '22 20:11

leppie