I get this error:
Error C4458 declaration of ‘MenuInterface’ hides class member NOM E:\UE\5S\NOM\Source\NOM\Menus\Men
here are my codes:
Cpp
// Fill out your copyright notice in the Description page of Project Settings.
#include "MenuM.h"
#include "Components/Button.h"
bool UMenuM::Initialize()
{
bool Success = Super::Initialize();
if(!Success) return false;
if (!ensure(Bt_Host != nullptr)) return false;
Bt_Host->OnClicked.AddDynamic(this, &UMenuM::HostServer);
return true;
//if(!ensure(MenuSwitcher)) return false;
}
void UMenuM::SetMenuInterface(IMenuInterface* MenuInterface)
{
this->MenuInterface = MenuInterface;
}
void UMenuM::HostServer()
{
if (MenuInterface != nullptr)
{
MenuInterface->Host();
}
//UE_LOG(LogTemp, Warning, TEXT("Hosting Server"));
/*if (MenuSwitcher != nullptr)
{
MenuSwitcher->SetActiveWidget(HostMenu);
}*/
}
H:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "MenuInterface.h"
#include "MenuM.generated.h"
/**
*
*/
UCLASS()
class NOM_API UMenuM : public UUserWidget
{
GENERATED_BODY()
public:
void SetMenuInterface(IMenuInterface* MenuInterface);
protected:
virtual bool Initialize();
private:
UPROPERTY(meta = (BindWidget)) //Remove
class UButton* Bt_Host; //Remove
UPROPERTY(meta = (BindWidget)) //Remove
class UButton* Bt_Join; //Remove
UPROPERTY(meta = (BindWidget)) //Remove
class UButton* Bt_Solo; //Remove
UFUNCTION()
void HostServer(); //Remove
IMenuInterface* MenuInterface;
};
I don’t know what I’m typeing wrong here