Why would someone call a non-static provate member function from
another non-static member function of the same class via the this
pointer?
I hardly ever do, but perhaps some people use it to make more clear
difference between what is a call to member function and what is not.
For example in this example you could be easily fooled to think that the
program prints out "Function1()", unless you note that there is a member
function with a same name. With larger files with multiple different
functions, using "this->" would point out clearly that you are calling a
member function.
-----------------------------------
#include <iostream>
void Function1()
{
std::cout << "Function1()" << std::endl;
}
class ThisExample
{
private:
void Function1()
{
std::cout << "ThisExample->Function1()" << std::endl;
}
public:
void Test()
{
Function1();
}
};
int main()
{
ThisExample example;
example.Test();
return 0;
}
-----------------------------------