Guys, all good day! Please help me to understand why we need delegates in C#. Why not stupid to make a function pointer like in C++ or at least to refer to class method, why come up with such a concept of "delegate"??? Thank you
Delegates can be considered more secure version of a function pointer. With rigidly predetermined function signature, and hence type checking.
Anticipating the next question, events in c# made for the protection of delegates from unauthorized call (as a getter/setter only for the delegate)
Lenny answered on April 3rd 20 at 18:55
everything is simple:
- wanna learn C#
- wanna learn C++
ps direct answer to the question elementarno searched on MSDN, a bunch of educational websites and books
pps well, or ready to debate in the comments.
let's start with another question - why do you C#? if that is so cute C++. please a detailed answer
moises58 answered on April 3rd 20 at 18:57
Well, first, there is no sharp pointers. The second is actually inside a pointer, just as wrote above more secure.