Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

What is the need for both UInterface and IInterface class declarations?

 #pragma once
 #include "TargetInterface.generated.h"
 class UTargetInterface : public UInterface
 class ITargetInterface{

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 :)

Product Version: Not Selected
more ▼

asked Oct 28 '14 at 05:28 AM in C++ Programming

avatar image

21 1 1 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first


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.


more ▼

answered Oct 30 '14 at 11:03 AM

avatar image

Steve Robb STAFF
2.8k 58 28 101

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question