Please see my comment to the question and also my past answer:
Catch 22 - Pointers to interface objects die when function using them is made static.[
^].
This answer is about C#, not C++ (sorry about it), but you can understand it, because the essence of thins is exactly the same:
C# windows base this key word related and its uses in the application[
^].
In other words, you need an instance of a class to call its instance function. Let's consider a call of a function with one argument:
myInstance.myFunction(parameterValue);
If you have a pointer to an instance, '.' operator simply becomes '->'.
In this schema,
myInstance
is passed as the first (implicit) argument and becomes "this" pointer inside a function, when it it called, and
parameterValue
(actual parameter) comes next, and so on.
Where to get
myInstance
? Ultimately, it should be returned by some constructor call. And so on… It would chain, question by question, to whole programming field, but it would make a little sense to try to answer all such question. Regular study, this is the only thing which helps.
—SA