cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Assigning a pointer-to object to another
Assigning a pointer-to object to another pointer-to object
Sep 12, 2008 at 2:20am UTC
jclim3
(1)
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!
Sep 12, 2008 at 2:27am UTC
Zhuge
(4664)
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.