samedi 28 février 2015

Scope resolution :: vs this ->


I am trying to understand pointers and scope in OOP with C++. Is there any difference at all between:



class Class
{
public:
void setVal (int value) {
this -> value = value;
}
int getVal();
private:
int value;
};


and this:



class Class
{
public:
void setVal (int value) {
Class::value = value;
}
int getVal();
private:
int value;
};



Aucun commentaire:

Enregistrer un commentaire