Overriding regular cpp function (no UFUNCTION) with warns C4263 & C4264

Hi :slight_smile:

Parent class:

UCLASS(Blueprintable, BlueprintType)
class R3_API USObject : public UObject
{
	GENERATED_BODY()

public:
	virtual void Init();
}

Child class:

UCLASS(Blueprintable, BlueprintType)
class R3_API USOrder : public USObject
{
	GENERATED_BODY()

public:
	void Init(int32 Iterations );
}

Visual Studio 2015 on Windows 7:

SOrder.h(16): warning C4263: 'void USOrder::Init(int32)': member function does not override any base class virtual member function

SOrder.h(41): warning C4264: 'void USObject::Init(void)': no override available for virtual member function from base 'USObject'; function is hidden

SObject.h(17): note: see declaration of 'USObject::Init'

Object.h(8): note: see declaration of 'USObject'

Also same warning is treating as error on OS X El Capitan via XCode/clang.
Please, help me understand what is the right way to make same named function in Child class with different signature. Thank you :slight_smile:

Now this is interesting indeed. You would think that the compiler would see these as two separate functions. At first I thought it would have been the case missing virtual function but the function signatures are completely different which should mean an overloaded function. Since they are not UFUNCTIONS you would think that the Unreal Build Tool (UBT) would not worry about it either…

My Test would be to Remove the UCLASS (and R3_API) and see if you still get this error. If you do NOT it’s the UBT and a bug, if you do… then its something with the C++ compiler itself and something we are both missing…

Thank you, it’s c++ feature :slight_smile:

class UMyObject
{
public:
	virtual void Init(int32 val1){};
};


class UMyObjectChild : public UMyObject
{
public:
	void Init(int32 val1, int32 val2){};
};

MyObjectChild.h(16): warning C4263: 'void UMyObjectChild::Init(int32,int32)': member function does not override any base class virtual member function
MyObjectChild.h(18): warning C4264: 'void UMyObject::Init(int32)': no override available for virtual member function from base 'UMyObject'; function is hidden
MyObject.h(17): note: see declaration of 'UMyObject::Init'
MyObject.h(13): note: see declaration of 'UMyObject'