Custom C++ Class with multiple inheritance

Hello, a basic question here:
Is it possible to create a custom C++ class usable later by an UActor as, let’s say, a component?

I am asking this for reasons like… having a class with multiple inheritance, where this is no possible with Unreal Engine C++ clases.



multiple inheritance with actor-components is doable.
If you for example search the solution for “public UActorComponent, public” or “public USceneComponent, public”, there exist a lot of occurences.


So let’s say I have C++ classes: A, B, C.

Can C inherit from A and B and then use C as a Component?

Components can’t have components, so no, C can’t have another copy of itself as a component, because that implies C is a component in the first place. But you can do multiple sources of inheritance. Almost always in that case though you need to ask yourself if using an Interface is more appropriate.

You cannot do multiple inheritance from more than one UObject type, and components can only exist within actors. The following is allowed:

class UMyComponent : public UActorComponent, public ISomeNativeInterface

This is NOT allowed:

class UMyComponent : public UActorComponent, public USomeOtherUObjectClass