Malfunctioning Overload/ Calling Private Function

May 16, 2019 at 6:32am
hi,

To me it looks like I'm calling a private function. Am I actually doing that?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class Movement
{
public:
void populatePossibleMoves(int actionsAvailable);
private:
void populatePossibleMoves(int actionsAvailable, Tile* currentTile);
};

class Person
{
};

void Person::populateMovements()
{
	myMovement->clearPossibleMoves();
	myMovement->findPossibleMoves(myActionPoints->getCurrentActionPoints(), nullptr);
}


Also:
In the header file, when I mouse over populatePossibleMoves it says
"+ 1 overload"
When I write the function call and try to use the public overload i get the error "too few arguments in function call"

Thanks for your time.
Last edited on May 16, 2019 at 6:32am
May 16, 2019 at 6:42am
Which function are you talking about?
May 16, 2019 at 6:44am
the private populatePossibleMoves()
May 16, 2019 at 6:47am
And where are you calling it?
May 16, 2019 at 6:54am
I am calling it in a public function (populateMovements) in class Person. It also builds and runs without errors, which has lead to my confusion as to why/how I'm doing so without the compiler saying how in the world did you get access to a private function in a class that you are not friends with.

edit:
2>------ Build started: Project: Nemi, Configuration: Debug x64 ------
2>Person.cpp
2>Nemi.vcxproj -> D:\Nemi\x64\Debug\Nemi.exe
========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

The program '[1684] Nemi.exe' has exited with code 0 (0x0).
Last edited on May 16, 2019 at 6:59am
May 16, 2019 at 7:17am
Your code snippet says you are calling
findPossibleMoves()
not
populatePossibleMoves()

If you want help you need to actually upload code that is causing the issue.
May 16, 2019 at 7:38am
Hi a10e29

Back to do some more trolling?

Just a warning to others.
May 16, 2019 at 7:52am
I must be going crazy. I found the problem, it was between the screen and the chair.
Topic archived. No new replies allowed.