first here is the example Code:
cPerson.h:
#pragma once
class cPerson
{
public:
cPerson();
~cPerson();
int Age;
};
cPerson.cpp
#include "cPerson.h"
cPerson::cPerson()
{
this->Age = 3; // Way 1
cPerson::Age = 4; // Way 2
}
cPerson::~cPerson() { }
Ok now my Question:
If we are defining a new Class in C++ there are two ways to set the initial Values. There is (Way 1) by using the "this"-pointer, or (Way 2) using the scope operator ( :: ). In school I learned it using "this->". Now, years after not using C++, I startet to get into it again and found this second way, using the scope operator. Both way work fine BUT what's the exact difference between them and what's the "faster"/"better" way? I'm that kind of guy who likes to know what exactly is going on in my ram/cpu if I'm programming.
So I hope someone can help me out, and thanks in advance.