A quick question: What benefit is there to making a pointer to a class object? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

A quick question: What benefit is there to making a pointer to a class object?

21st Jun 2016, 1:24 PM
Andy Ponce
Andy Ponce - avatar
2 Answers
+ 3
I'm just trying to get the hang of pointers myself, but I believe, like a pointer, you would use it to get the memory of something that is in the class. Then you can, if I'm understanding this right, change the variable by value instead of by reference, which we would do if we just simply used the original variable rather than the pointer? And if I'm also understanding this correctly, it uses less memory and is a lot faster
27th Jun 2016, 5:06 AM
ethan
ethan - avatar
+ 1
1) dynamic allocation 2) resides in memory unless freed using free in c or delete in c++
21st Oct 2016, 9:35 PM
PANKAJ KUMAR
PANKAJ KUMAR - avatar