Sign in to follow this  

what does "delegate" mean?!!

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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,

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this