Can I get some help?

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

I was able to fix it, In the Menu.cpp file

replease this part

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

whit this

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

Just so you are aware, the message is due to overriding a method in a base class without the use of the override keyword. This effectively hides the base method and so you cannot call it.

Sometimes this is the desired effect so when it is, there a way to indicate this - new I think but not 100% sure. This would be a pretty rare thing to do.

When you see this error, usually you need to add the override keyword to the definition of the method in question in the header.

Here for reference material: override specifier (since C++11) - cppreference.com

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.