How? Function override in C++

En: Please help to overload a function in C++
Ru: Пожалуйста, помогите перегрузить функции в C++

2017-07-04_20-00-22.png
2017-07-04_20-00-47.png

En: Overload is needed in C++, function overloading different incoming and outgoing data with preservation of function names.
Ru: Перегрузка нужна внутри на C++, перегрузка функций разными входящими и исходящими данными с сохранением имён функций.

You can’t overload a non-virtual method. Statics are non-virtual and cannot be made virtual. You’d need to add a new method that does what you want.

2 Likes

He’s 100% correct. Just create a non-static virtual function that FVector Clamp calls.

en: Probably we each other a little bit don’t understand, talking about the usual overload, which we can use in any program in C++ when writing any program, even without the UE.

In C++ there is such a thing that functions with the same name can accept different arguments and work as different functions, including the function that satisfies the incoming data.

I would like to have several functions with the name “Clamp”, working with different arguments.

ru: Наверное мы друг-друга немного не понимаем, речь о обычно перегрузке, которую мы можем использовать в любой программе на C++ при написании любой программы, даже без UE.

В C++ есть такая штука, что функции с одинаковым именем, могут принимать разные аргументы и работать как разные функции, включая ту функцию, которая удовлетворяет входящим данным.

Я хотел бы получить несколько функций с именем “Clamp”, работающими с разными аргументами.


void set(int);
void set(float);
void set(int, int);

PS: I value your answers.

You cannot overload UFUNCTION() like you can with raw C++ methods.
You can however add a prefix to each function and set their Display Name to be the same for all of them nodes.

Please, could you give an example of prefix.

I made the prefix on the direct meaning of this and got quite the expected result:
2017-07-06_18-42-48.png
2017-07-06_18-41-34.png

In fact, the engine comes with such features as:
6f18776c6d0c7e7c35e82db832ccd1f0d9ab3f3e.jpeg

: I have studied your work, I found the buttons in your signature.

Found that you use the “meta”!
I tried to use the same thing and voila:


3d72406692272041407b4a417a9b0cd8a70a839d.jpeg

You are my Saviour!) T4U!))

ru: проблема решена, используйте meta, как на картинке, для именования функций в движке.
Всё что есть в meta: UFUNCTION -> meta документация.

Solution