How to use UE5 C++ interface?

foreword

This question hides two pre-questions:
(1) What is an interface Interface?
(2) Why use an interface?
Native C++ has no interface. The reason why I know the interface is because I used C# before, and it is often used in C# To the interface, and it is very easy to use. In the UE engine, we often find the shadow of C#, such as the build script is Build.cs, then the developer of the engine must also use C#, and must also know the interface, maybe it is out Because of knowing the benefits of the interface, there is the concept of Unreal Interface in UE C++.

0 What is an interface?

The so-called interface is the consensus agreed between classes. This consensus can allow uncoupling collaboration between classes. This definition seems a bit difficult to understand, so it’s better to make a metaphor. You may have seen some spy War movies, or Mr. Jin Yong's The Deer and Ding Ji (Wei Xiaobao engraved on the soles of the feet to restore the Ming). There is such a scene, A and B do not know each other, but they need to exchange information. In order to ensure the safety of both parties, they need to know as little as possible about each other. Information.
In this case, A only needs to say: Heavenly King Gaidihu, if B answers: Pagoda Town River Demon

Guess you like

Origin blog.csdn.net/qq_30137245/article/details/130784309