Archived

This topic is now archived and is closed to further replies.

Grudgian

Pointer Question.....

Recommended Posts

Alright right now I am doing a chapter on Inheritance and I ran across a pointer which confused me, so if anyone can explain what this pointer is doing: Point * pointPtr = 0, p( 30, 50 ); Alright here is what I know, pointPtr is pointing to a Point object. The intialization is what is confusing me. First off why is the 0 there? I know p is a point object and 30, 50 is used in its constructor, but why don''t u have to use new? Thanks, Chris

Share this post


Link to post
Share on other sites
Woah, I must have blanked on that one. I figured the problem which was too easy, but those are usually the ones that get us the best.

Point * pointPtr = 0, // declares and initializes Point pointer to 0.

p( 30, 50 ); //declares p a POINT object and calls constructor.

Wooooo, gotta love it when you get those dense moments.

Thanks again,
Chris

Share this post


Link to post
Share on other sites