Inherit an interface from another interface

Hey!
Ue naturally does not allow multiple inheritance, because of epics reflection system.
Unfortunatly this is bad for native OOP but for this from reflection system we get so many good things.

Based on this forum topic: Interfaces inheriting from other interfaces - C++ Programming - Unreal Engine Forums
I guess you can inherit from other interface in c++, but i did not tested this old topic and maybe dont work :slight_smile:
Other thing im sure reflection system and ubt/uht will not love if you do multiple inheritance in c++ and maybe wont will work or useable in Blueprint :wink:

Anyway this is not bug… i guess.
We have reflection system, which is super usefull and easy to use and reflect anything for everything (like networking, bp etc) and we have component based architecture.
Classes can have multiple interfaces, so actually you can do everything without multiple inheritance… but we cant enjoy advantages of oop architect like multiple inheritance :slight_smile:

I think epic did a good trade :slight_smile:

I guess i’m not the first to report this…

Why interface blueprints doesn’t allow to inherit from another interface blueprint?

Is a completely valid action in object oriented programming, and visual studio supports it without problems, is it possible to do in c++ but not in blueprints?

I’m not sure this addresses the problem… For one thing, inheritance between interfaces does not imply multiple inheritance in OOP, you can have interface A, interface B extending A, and class C implementing interface B. Secondly, multiple inheritance between interfaces is valid and useful. Again, let’s say I have interfaces A and B, and a class C that implements both of them. Then, I have a function F somewhere that works with objects implementing both A and B. If I want F to work with C (using interfaces without inheritance), I would have to create a new interface, AplusB, manually copy the function signatures from A and B to it (and keep them in sync if I ever change them) and add that interface to C (in addition to A and B, not in replacement, because I still want C to work with functions accepting A or B). Ideally, I would have an interface AplusB inheriting A and B (so I don’t need to manually add anything to it) and that would be the only interface C would need to implement.

1 Like

Inheritance is not necessary. All you need to do is to implement all the interfaces you want to an object (it can be actor or widget or anything is inherited from object class), then all you need to do is pass the object type in your functions and call any interface function on that object as message.
image