What is the need for both UInterface and IInterface class declarations?
I am working on creating a interface in code and was wondering what the need was for having both the Uinterface and Iinterface class declarations when implementing the interface.
If anyone could explain it to me that would be great :)
asked Oct 28 '14 at 05:28 AM in C++ Programming
The UInterface is the UObject which holds all the reflection information about the interface. As it's a UObject, it has all the facilities you normal expect from a UObject (has a name, can be serialised, can be reflected, etc.).
The IInterface is the actual native class which the compiler uses to inject virtual functions into your class, generated the correct vtable entries, make calls through etc.
The IInterface cannot be a UInterface (and thus a UObject) for several reasons, but the major one is that UObjects are intended to form a cosmic hierarchy and inheriting an IThing which was also a UObject would mean your class would have multiple UObject bases, which leads to the usual diamond-shaped inheritance problem: http://en.wikipedia.org/wiki/Multiple_inheritance#The_diamond_problem
We recognise that it's a bit clunky and would like to clean it up so that the UInterface is implicitly generated, but we currently have no timescale for that to happen.
answered Oct 30 '14 at 11:03 AM
Steve Robb STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here