Hello, i encountered such a problem if I created an interface and declared the function foo (), then if I inherit a class from this interface and do not implement the function foo (), then there will be no compilation error. Although it should be. It’s look like in C#. If you inherit a class from interface you will need to implement all functions else you will get compilation error. Or in C++ with plural virtual functions the same pattern. Example below:
#pragma once
#include "ReactsToTimeOfDay.generated.h"
UINTERFACE(BlueprintType)
class MYPROJECT_API UReactsToTimeOfDay : public UInterface
{
GENERATED_UINTERFACE_BODY()
};
class MYPROJECT_API IReactsToTimeOfDay
{
GENERATED_IINTERFACE_BODY()
public:
//classes using this interface must implement ReactToHighNoon
UFUNCTION(BlueprintNativeEvent, BlueprintCallable, Category = "MyCategory")
bool ReactToHighNoon();
//classes using this interface may implement ReactToMidnight
UFUNCTION(BlueprintImplementableEvent, BlueprintCallable, Category = "MyCategory")
bool ReactToMidnight();
};
#include "ReactsToTimeOfDay.h"
#include "ASkeletalMeshActor.generated.h"
UCLASS()
class AFlower : public ASkeletalMeshActor, public IReactsToTimeOfDay
{
GENERATED_BODY()
public:
/*
... other AFlower properties and functions declared ...
*/
//UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category = "MyCategory")
// bool ReactToHighNoon();
// virtual bool ReactToHighNoon_Implementation() override; <- We should get a compilation error, but not.
};