Why the pointer points to the object. What is the point of doing this | SoloLearn: Learn to code for FREE!

+2

Why the pointer points to the object. What is the point of doing this

MyClass obj; MyClass *ptr = &obj; //why we did that ptr->myPrint();

6/1/2020 3:46:49 AM

Abdallah Nagy

5 Answers

New Answer

+4

https://stackoverflow.com/questions/22146094/why-should-i-use-a-pointer-rather-than-the-object-itself There you can see your answer

+4

It is one of the reasons that people prefer other languages.

+1

bluesea ya thats a good point😅

0

Thanks, that helped me:)

-3