Pointer Question.....

Started by
1 comment, last by Grudgian 22 years, 8 months ago
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
Advertisement
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
Not your fault. That trash would never pass a professional code review.

This topic is closed to new replies.

Advertisement