what does "delegate" mean?!!
Hi,
I have been reading to learn OOP C++, I only had basic C++ knowledge before and now I'm learning about data structures and stuff but the pdfs I'm following explains nothing about the meaning of "delegate"!
I also searched on the internet but with no luck!
Any idea what "delegate" in programming is?!
Thanks
DiginDigin
Basically, a global OR member function pointer that you can pass around as an object and invoke later. I.e., you have a class MyClass with a method MyFunction, which you want to call later. You store it in a "delegate" object so that you can invoke that method of your particular MyClass instance later. Google "fast delegates," the first link is pretty useful, and oft-referred to in C++ delegate programming.
Essentially the term delegate means to transfer a task or responsibility to elsewhere. In the case of programming this means using a mechanism that allows you to invoke a function indirectly. C++ has the notion of function pointers, these are pointers to functions; they behave somewhat like regular data pointers in that they can be stored, passed around and dereferenced. So you can use a function pointer to indirectly call whatever function it may point to; it's a simple as that really.
Ok.. I can now understand that, the book is really philosophical.. It's like C++ programming philosophy.. I need some help finding good series to learn from.. I have a test tomorrow and need to study, so can you recommend some free books?
"When using C++ data structures as we have learned the programmer must be aware that "Can is not the same as should"".. I really hate the cryptic language,, is there any other pdf series or complete free tutorials that you know of?
Do you know what that text means anyway?!
Thanks,
"When using C++ data structures as we have learned the programmer must be aware that "Can is not the same as should"".. I really hate the cryptic language,, is there any other pdf series or complete free tutorials that you know of?
Do you know what that text means anyway?!
Thanks,
Quote:Original post by DiginDigin
Ok.. I can now understand that, the book is really philosophical.. It's like C++ programming philosophy.. I need some help finding good series to learn from.. I have a test tomorrow and need to study, so can you recommend some free books?
"When using C++ data structures as we have learned the programmer must be aware that "Can is not the same as should"".. I really hate the cryptic language,, is there any other pdf series or complete free tutorials that you know of?
Do you know what that text means anyway?!
Thanks,
What's the name of this C++ philosophy book?
Quote:Original post by DiginDigin
"When using C++ data structures as we have learned the programmer must be aware that "Can is not the same as should"".. I really hate the cryptic language,, is there any other pdf series or complete free tutorials that you know of?
Do you know what that text means anyway?!
Just because you CAN do something within the rules of a programming language does not always mean that it's good practice. A real world analogy would be bad eating habits for example, you can do it, many people do it (and consequently die from it), but most people will tell you it's bad and should be avoided.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement