Function overloading in TS
by Gennady · in Torque 3D Beginner · 05/14/2011 (12:52 pm) · 2 replies
Hi all!
I'm trying to understand the mechanics of internal function invocations in Torque and here's one trouble in the face functions' overloading. From the C++' times there was a rule, that overloaded functions must differ one from another by the list of arguments. But what we've got here - a lot of functions with one name, one list of arguments (null) and different inner code. My Codeweaver without any doubt call these function overloaded. So, the name - is not my goal. I'd want to know how the engine "understand" which function it ought to invoke?
Example: the most simple that everyone saw (I suppose). Template, first main.cs, in the end of this file there is an invocation of function on Start(). But this function exist in 3 files.
It will be great if somebody explain me how it works!
Thanks!
I'm trying to understand the mechanics of internal function invocations in Torque and here's one trouble in the face functions' overloading. From the C++' times there was a rule, that overloaded functions must differ one from another by the list of arguments. But what we've got here - a lot of functions with one name, one list of arguments (null) and different inner code. My Codeweaver without any doubt call these function overloaded. So, the name - is not my goal. I'd want to know how the engine "understand" which function it ought to invoke?
Example: the most simple that everyone saw (I suppose). Template, first main.cs, in the end of this file there is an invocation of function on Start(). But this function exist in 3 files.
It will be great if somebody explain me how it works!
Thanks!
About the author
Specialist of International center for professional training in Rosatom Technical Academy
#2
06/03/2011 (7:50 am)
To add a bit to the Mich explanation, you can also have a server function and client function with the same name, and not having interference between them.
Associate Michael Hall
Distracted...