MenuInterface hides class member

I know that there is a closed thread about this, but i am unable to understand how to fix it. i have downloaded the file from github, i have copied the text from online and pasted it into visual studio 2019 (v 4.8.03752)and all times i get the C4458 error.

void UMainMenu::SetMenuInterface(IMenuInterface* MenuInterface)
{
    this->MenuInterface = MenuInterface;
}

void UMainMenu::HostServer()
{
    UE_LOG(LogTemp, Warning, TEXT("Host Button clicked"));
    if (MenuInterface != nullptr)
    {
        MenuInterface->Host();
    }
}

I have tried renaming all the MenuInterface pointers (links) to AMenuInterface and it builds but nothing happens

void UMainMenu::SetMenuInterface(IMenuInterface* MenuInterface)
{
    this->AMenuInterface = MenuInterface;
}

void UMainMenu::HostServer()
{
    UE_LOG(LogTemp, Warning, TEXT("Host Button clicked"));
    if (AMenuInterface != nullptr)
    {
        AMenuInterface->Host();
    }
}

Any kind of help would be great, even if it is just remake this point of the video for future people

Thanks

Seems like you are probably getting a compilation warning and that is not the actual issue. Could you give us a bit more context to what you are expecting and what isn’t happening?

If I have the code like what is in the video and save it in VS. When ue4 starts up, the app crashes on startup and the only way I have been able to fix it is by having the code like in the second code layout.

That’s what I am finding let’s VS compile and for ue4 to start up and run the game. Will be happy to upload a copy of both files (one that crashes ue4 and one that dosent crash ue4) to make looking into the problem easy

Hey @crash987,
I stumbled upon the same problem you had and I am not quite sure why this is happening, hopefully with some extra context @sampattuzzi can tell us what is going on here, as I am quite curious as to why this is happening.
I did however manage to fix it by naming the IMenuInterface* parameter to something else than the name of the local IMenuInterface* variable.

Some screenshots:
MainMenu.h:
Knipsel

MainMenu.cpp:
Knipsel1

Original compiler error message:

Hope this helps!

This is what is stopping me from continuing doing the course, I am really loving it, just a shame there seems to be no or little help on fixing it. I think this part needs a rework so others don’t have the same problem

Could you show me your MainMenu.h?

Also, this->AMenuInterface = MenuInterface; is not necessary as the parameter is not named the same as the local variable. So AMenuInterface = MenuInterface; should be fine.

Make sure to delete your binaries and intermediates folders to make sure the compilation is up-to-date.

Hi Sam, i have just tried your idea of deleting the binaries and intermediates folder for the project, still getting the same problem “Error C4458 declaration of ‘MenuInterface’ hides class member”.

Is there a workaround that would get this fixed