+ 1
A quick question: What benefit is there to making a pointer to a class object?
2 Antworten
+ 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
+ 1
1) dynamic allocation
2) resides in memory unless freed using free in c or delete in c++