In the video it was just Reset(); without “FBullCowGame::” in front of it. While I see that it indeed works just as fine, I am wondering why that is. In PHP/Java I would go for something like
this.Reset();
but never just type the function name.
The same of course applies to the getter functions, I thought, it should be something like
The short answer - you’re right that it is redundant because we are inside the class scope.
Long answer - under certain circumstances you still may need to have the class name when you have inheritance (if you’re familiar with it) and want to call a similarly named parent class function (i.e. to resolve a naming conflict aka ambiguous function call). E.g. in Java you have the super keyword, but in C++ you’ll have to write the parent class name
super.Reset(); // Java
MyParentClass::Reset(); // C++
In our example, both this and FBullCowGame:: are implied by the compiler so we can skip them, but you also can have them like so:
FBullCowGame::FBullCowGame() {
this->FBullCowGame::Reset(); // same as simply calling Reset();
}