# What is the proper way to implement an interface function that returns a struct in C++?

**URL:** <https://forums.unrealengine.com/t/what-is-the-proper-way-to-implement-an-interface-function-that-returns-a-struct-in-c/487490>\
**Category:** UI\
**Tags:** interface, Struct, return, unreal-engine, CPP, question\
**Created:** [August 16, 2021, 2:09am UTC](https://forums.unrealengine.com/t/what-is-the-proper-way-to-implement-an-interface-function-that-returns-a-struct-in-c/487490 "2021-08-16T02:09:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Althaen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Althaen](https://forums.unrealengine.com/u/Althaen)\
**Post date:** [August 16, 2021, 2:09am UTC](https://forums.unrealengine.com/t/what-is-the-proper-way-to-implement-an-interface-function-that-returns-a-struct-in-c/487490/1 "2021-08-16T02:09:08Z")

</div>

I can’t find any examples of how to do this anywhere but I did find something in the engine and tried to copy the syntax but I can’t get it to work.

I get this error

```
unresolved external symbol "public: virtual struct FEntityData const & __cdecl IIEntity::GetEntityData(void)const " (?GetEntityData@IIEntity@@UEBAAEBUFEntityData@@XZ)

```

Declaration in class implementing

```
	virtual const struct FEntityData& GetEntityData() const override;   

```

Implementation in class implementing

```
const FEntityData& AGameCharacter::GetEntityData() const
{
	return EntityData;
}

```

Declaration in interface class

```
	virtual const FEntityData& GetEntityData() const;
```

---

<div class="post-metadata">

**Author:** ![Althaen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Althaen](https://forums.unrealengine.com/u/Althaen)\
**Post date:** [August 16, 2021, 4:54am UTC](https://forums.unrealengine.com/t/what-is-the-proper-way-to-implement-an-interface-function-that-returns-a-struct-in-c/487490/2 "2021-08-16T04:54:48Z")

</div>

Had to implement a default implementation in the interface class.
