Is it like overloading, if not all, you have to c C =
The answers to the questions asked are read ... I did not understand the responses posted on it.
Asked the same type of question
EDIT: Keywords in the new "dynamic" C # 4.0 ... Will this language enable "multi-dispatch"?
C # uses a single dispatch, which contains the methods that are overloaded when you have the code
stringbuilder.Append (parameter);
The sender looks at all the methods defined on the stringbugler's class, and finds the right one.
For multiple transmission examples, we can see the prologue (which I first thought), you can define a function such as prolog:
func (Arg1, Arg2): - .... body ....
This is not defined in any category but in a global field. After that, you can call func (Arg1, Arg2)
on any two arguments and this function will be called. If you must, you must validate the argument types in the function if you want something like overloading, and define it many times:
func (Arg1, Arg2): - is_number (Arg1) , Is_string (Arg2)), .... body .... func (Arg1, Arg2): - is_string (Arg1), is_list (Arg2), .... body .... func (Arg1, Arg2): - is_number (Arg1), Is_list (Arg2), .... body ....
Then, the two logic types you send will be examined - one by one There is a more dispersal part.
In short, a single dispatch appears only on the methods defined in the first argument (in our first example, stringbilders), then resolves the correct overload to call using other arguments. The methods / functions of multiple dispatch are defined in the global scope and during the overload resolution all the arguments are considered the same.
I hope I will make myself clear, this is a very difficult topic.
UPDATE: I forgot to mention, on multiple send timeline, there is a dispatch at the time.
Update # 2: Obviously, this was not true.
Comments
Post a Comment