471,337 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Help me with delegates

I have been putting it off, but I think i need to become better versed in
delegates. I have been reading about them and I am unable to discern how to
use them or when to use.

It would seem to me, at least in one instance, that you would define a
delegate in a parent object to allow child objects to access in threaded
applications, code reusability, or as plain call-backs. But how.

Lets say you have a pop server class and a session class. The pop server
will want to know when a session authenticates so that it can prepare
information for the rest of the session. We need the pop server to complete
this task before completing the authentication process, but we do not want
the rest of the sessions to wait for this to complete. So I was thinking,
have the pop server perform the authentication, prepare information, return
the result.

public class popserver

'Create our delegate
public delegate function Authenticate(SessionID as string, UserName as
string, Password as string)

'Create our delegate handler
public function DoAuthenticate as Authenticate
return bResult
end function

end class
public class Session
'Consume our deleagate
'But how
end class
TIA
Jul 22 '05 #1
0 879

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by AMDRIT | last post: by
reply views Thread by Siegfried Heintze | last post: by
13 posts views Thread by Praveen | last post: by
4 posts views Thread by Miro | last post: by
2 posts views Thread by hcaptech | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.