Click here to Skip to main content
15,914,642 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalproblem about variable scope Pin
HeartFriend7-Apr-05 17:27
HeartFriend7-Apr-05 17:27 
GeneralRe: problem about variable scope Pin
Christian Graus7-Apr-05 17:35
protectorChristian Graus7-Apr-05 17:35 
GeneralRe: problem about variable scope Pin
Ryan Binns7-Apr-05 18:11
Ryan Binns7-Apr-05 18:11 
GeneralRe: problem about variable scope Pin
HeartFriend7-Apr-05 19:06
HeartFriend7-Apr-05 19:06 
GeneralRe: problem about variable scope Pin
cmk7-Apr-05 19:45
cmk7-Apr-05 19:45 
GeneralRe: problem about variable scope Pin
Michael Dunn7-Apr-05 20:28
sitebuilderMichael Dunn7-Apr-05 20:28 
GeneralRe: problem about variable scope Pin
S. Senthil Kumar7-Apr-05 21:58
S. Senthil Kumar7-Apr-05 21:58 
Questionhow to check if a reference is NULL Pin
ng kok chuan7-Apr-05 17:07
ng kok chuan7-Apr-05 17:07 
hi, i have a class that is defined below:

class DVertex
{
public:
DVertex(MazeNode*)
{
this->node = n;
this->parent = NULL;
this->cumulativeCost = DBL_MAX;
}

// member functions
void update(MazeNode*, double); // update the parent and cost.

double getCCost() const { return cumulativeCost; } // required to relax the node.
MazeNode& getNode() const { return *node; } // required to identify the node.
MazeNode& getParent() const { return *parent; } // required for reverse lookup.


private:
MazeNode *node;
MazeNode *parent;
double cumulativeCost;
};

now the problem is when i tried to check the value of parent, i.e.

void main()
{
DVertex v;
if (v.getParent()==NULL)
; // do something
}

this will not work..

however if i change the class to return me MazeNode*, i.e.
MazeNode* getParent() const { return parent; }

then i can do that the check.

anyone know how to check if a reference is null?

and by the way, can tell me how to change the inline constructor to something shorter? i remember seeing something like Constructor(<type> par1):var1=par1; but can't remember the exact syntax.

thanks!!
AnswerRe: how to check if a reference is NULL Pin
Ryan Binns7-Apr-05 18:14
Ryan Binns7-Apr-05 18:14 
GeneralRe: how to check if a reference is NULL Pin
ng kok chuan7-Apr-05 20:50
ng kok chuan7-Apr-05 20:50 
GeneralRe: how to check if a reference is NULL Pin
S. Senthil Kumar7-Apr-05 22:13
S. Senthil Kumar7-Apr-05 22:13 
QuestionHow to HitTest an item of a List Ctrl owned by another thread Pin
Luckybird7-Apr-05 16:23
Luckybird7-Apr-05 16:23 
AnswerRe: How to HitTest an item of a List Ctrl owned by another thread Pin
Ryan Binns7-Apr-05 18:18
Ryan Binns7-Apr-05 18:18 
GeneralRe: How to HitTest an item of a List Ctrl owned by another thread Pin
Luckybird7-Apr-05 23:29
Luckybird7-Apr-05 23:29 
GeneralRe: How to HitTest an item of a List Ctrl owned by another thread Pin
Ryan Binns8-Apr-05 2:12
Ryan Binns8-Apr-05 2:12 
Generalpliz help me with input validation Pin
mpapeo7-Apr-05 15:05
mpapeo7-Apr-05 15:05 
GeneralRe: pliz help me with input validation Pin
Christian Graus7-Apr-05 15:14
protectorChristian Graus7-Apr-05 15:14 
GeneralRe: pliz help me with input validation Pin
Anonymous7-Apr-05 15:35
Anonymous7-Apr-05 15:35 
GeneralRe: pliz help me with input validation Pin
Christian Graus7-Apr-05 15:39
protectorChristian Graus7-Apr-05 15:39 
GeneralRe: pliz help me with input validation Pin
mpapeo7-Apr-05 15:50
mpapeo7-Apr-05 15:50 
GeneralRe: pliz help me with input validation Pin
Christian Graus7-Apr-05 15:52
protectorChristian Graus7-Apr-05 15:52 
GeneralRe: pliz help me with input validation Pin
mpapeo8-Apr-05 1:48
mpapeo8-Apr-05 1:48 
GeneralRe: pliz help me with input validation Pin
David Crow8-Apr-05 5:29
David Crow8-Apr-05 5:29 
GeneralRe: pliz help me with input validation Pin
LighthouseJ7-Apr-05 15:48
LighthouseJ7-Apr-05 15:48 
GeneralRe: pliz help me with input validation Pin
mpapeo7-Apr-05 15:59
mpapeo7-Apr-05 15:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.