# How to call interface function from base class?

**URL:** <https://forums.unrealengine.com/t/how-to-call-interface-function-from-base-class/437914>\
**Category:** UI\
**Tags:** interface, unreal-engine, functions, UE4, question, CPP, calls\
**Created:** [November 19, 2018, 12:51pm UTC](https://forums.unrealengine.com/t/how-to-call-interface-function-from-base-class/437914 "2018-11-19T12:51:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_Q\_R](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@S\_Q\_R](https://forums.unrealengine.com/u/S_Q_R)\
**Post date:** [November 19, 2018, 12:51pm UTC](https://forums.unrealengine.com/t/how-to-call-interface-function-from-base-class/437914/1 "2018-11-19T12:51:00Z")

</div>

Title says its all. I’m struggling with calling implementation of my interface funtion from the base class.  
Here is an example:  
I got interface, let’s call it `ITestInterface`

```
    class MYPROJ_API ITestInterface
    {
    	GENERATED_BODY()
    
    	// Add interface functions to this class. This is the class that will be inherited to implement this interface.
    public:
    	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
    	void MyTestFunction();
}

```

and I got class that implements this interface

```
UCLASS()
class MYPROJ_API ABaseTestActor : public AActor, public ITestInterface
{
	GENERATED_BODY()
	
public:	
	ATestActor();

	virtual void MyTestFunction_Implementation() override;
};

```

and than I got derived class.

```
UCLASS()
class MYPROJ_API ADerrivedTestActor : public ABaseTestActor
{
	GENERATED_BODY()
public:
	ADerrivedTestActor ();
    	
    	virtual void MyTestFunction_Implementation() override;
}

```

Inside of the `DerrivedTestActor::MyTestFunction_Implementation()`  
I want to do something like `Super::MyTestFunction()` but since it’s and interface  
I have to use proper `Execute_` call and pass the pointer to the object on which the function should be called.  
I 've tried Super::Execute\_MyTestFunction(this) and it compiles but I got “Fatal Error” during the runtime.

I’ve also tried something like this

```
Super* thisSuper = Cast<Super>(this);
thisSuper->Execute_HandleGrab(thisSuper)

```

but it also throws Fatal Error during runtime.

Does anyone know how to call such a function? thanks in advance.

---

<div class="post-metadata">

**Author:** ![MazyModz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MazyModz](https://forums.unrealengine.com/u/MazyModz)\
**Post date:** [November 19, 2018, 3:16pm UTC](https://forums.unrealengine.com/t/how-to-call-interface-function-from-base-class/437914/2 "2018-11-19T15:16:33Z")

</div>

Hello,

It should be as simple as doing this:

```
// DerrivedTestActor.cpp

void ADerrivedTestActor::MyTestFunction_Implementation()
{
    Super::MyTestFunction_Implementation();
}

```

You should not need to call the interface Execute\_, just the implementation function.  
The Execute\_ function should only be used from other classes to avoid casting to specific types.

~ Dennis “MazyModz” Andersson
