Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition
by John P. Doran, William Sherif, Stephen Whittle
How it works...
C++ uses multiple inheritance in the way it implements interfaces, so we leverage that mechanism here with the declaration of our SingleInterfaceActor class, where we add public IMyInterface.
We inherit from IInterface rather than UInterface to prevent SingleInterfaceActor from inheriting two copies of UObject.
Given that the interface declares a virtual function, we need to redeclare that function with the override specifier if we wish to implement it ourselves.
In our implementation file, we implement our overridden virtual function.
Inside our function override, for demonstration purposes, we call the base IInterface implementation of the function. Alternatively, we could write our own implementation and avoid calling the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access