Announcement

Collapse
No announcement yet.

How? Function override in C++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How? Function override in C++

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

    Click image for larger version

Name:	2017-07-04_20-00-22.png
Views:	1
Size:	10.9 KB
ID:	1224882
    Click image for larger version

Name:	2017-07-04_20-00-47.png
Views:	1
Size:	1.4 KB
ID:	1224883

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

    Comment


      #3
      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.
      Able Ability System - A high performance, robust ability system for UE4. Now Available!

      Comment


        #4
        Originally posted by ExtraLifeMatt View Post
        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.
        He's 100% correct. Just create a non-static virtual function that FVector Clamp calls.
        Portfolio/Tutorials: http://chadreddick.com

        Comment


          #5
          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);
          --------------------

          https://msdn.microsoft.com/library/5dhe1hce.aspx
          PS: I value your answers.

          Comment


            #6
            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.
            | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

            Comment


              #7
              Originally posted by BrUnO XaVIeR View Post
              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:
              Click image for larger version

Name:	2017-07-06_18-42-48.png
Views:	1
Size:	11.8 KB
ID:	1130713
              Click image for larger version

Name:	2017-07-06_18-41-34.png
Views:	1
Size:	25.1 KB
ID:	1130714

              In fact, the engine comes with such features as:
              Click image for larger version

Name:	c5cVQ6MqeJI.jpg
Views:	1
Size:	17.1 KB
ID:	1130715

              Comment


                #8
                BrUnO XaVIeR: 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:
                Click image for larger version

Name:	2017-07-06_19-22-44.png
Views:	1
Size:	14.1 KB
ID:	1130717
                Click image for larger version

Name:	6DMepFtv7Jg.jpg
Views:	1
Size:	29.4 KB
ID:	1130718

                You are my Saviour!) T4U!))

                ru: проблема решена, используйте meta, как на картинке, для именования функций в движке.
                Всё что есть в meta: UFUNCTION -> meta документация.
                Last edited by Dr.Freeman; 07-06-2017, 12:48 PM.

                Comment

                Working...
                X