vendredi 10 avril 2020

What are difference between * and & for objects in c++

First of all
I know the differences between & and * for variables but not for the objects of a class

consider I have a class let's call it a "Math"

Math math; // a simple object called math Math* mathPtr = &math; // this will holds the address of math object Math& mathRef = math ; // this one is exactly equivalent to the previous one

What are the differences ?!

Aucun commentaire:

Enregistrer un commentaire