Assigning a pointer-to object to another pointer-to object

Hello! I need some clarification about the code snippet below:

Line 1: object * hello1 = new object;
Line 2: object * hello2;
Line 3: hello2 = hello1;

Is the assignment in line 3 valid?

Thanks in advance!
Yes because the pointers are of the same type...however, you need to be careful with something less simple than that because of how pointers work in relation to parent and child classes.
Topic archived. No new replies allowed.