How to use BP enum in C ++ code?

You don’t. C++ cannot use Blueprint Objects. The other way works fine though, so if you want to use an enum in C++ and Blueprint, just define your enum in C++.

However if you cant define the enum in C++, you can return a byte and then cast in your blueprint, as every enum value represents a numeric value.

I have an enumeration named “MyEnum”. How do I create a C ++ function that returns an element of this enum?

Those that look like this: UMyEnum Func () {}