# Interface as UPROPERTY, class member?  \[C++\]

**URL:** <https://forums.unrealengine.com/t/interface-as-uproperty-class-member-c/279976>\
**Category:** UI\
**Tags:** garbage-collector, interface, unreal-engine, UInterface, CPP, question\
**Created:** [April 8, 2014, 1:00pm UTC](https://forums.unrealengine.com/t/interface-as-uproperty-class-member-c/279976 "2014-04-08T13:00:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![undercover](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@undercover](https://forums.unrealengine.com/u/undercover)\
**Post date:** [April 8, 2014, 1:00pm UTC](https://forums.unrealengine.com/t/interface-as-uproperty-class-member-c/279976/1 "2014-04-08T13:00:28Z")

</div>

Hi!

To create an interface you must create two classes, one with the macro UINTERFACE which is deriving UInterface and one “normal” class that contains all the interface’s pure virtual methods. Is this correct understood? source: [[Question] C++ Interfaces? - UI - Unreal Engine Forums](https://answers.unrealengine.com/questions/4083/question-c-interfaces.html).

When I have created my interface it seems like it can’t be used as a UPROPERTY and therefore not automatically added to the garbage collector. **What type of pointer should one use to make a UINTERFACE a member of an other UCLASS such that it’s managed by the garbage collector and references are increased and decreased properly? Is there some equivalent to `std::unique_ptr` from C++11 for unique objects?** The UINTERFACE will only be implemented by classes that inherits UObject.

As a side note:  
I also tried to make an abstract UCLASS but seems like an UCLASS can’t have pure virtual members even though it’s created with UCLASS(Abstract). This seems a bit weird to me since having abstract/pure virtual methods is pretty much what makes an abstract class abstract except in some special cases.  
I get the following compilation error message:

`error C2259: 'UGUIComponent' : cannot instantiate abstract class due to following members: 'void UGUIComponent::test(void)' : is abstract`

where UGUIComponent is my class with the method `virtual void test() = 0;`

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [April 8, 2014, 1:45pm UTC](https://forums.unrealengine.com/t/interface-as-uproperty-class-member-c/279976/2 "2014-04-08T13:45:27Z")

</div>

#Inherit Interfaces

You use multiple inheritance with interfaces, so for any class you want to implement an interface, you add the additional inheritance.

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

I have entire instructions and complete tutorial on interfaces here:

#UE4 Interfaces Wiki

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
