motivation behind delegates

From: Flip ([remove_me)
Date: 01/27/05


Date: Thu, 27 Jan 2005 15:51:12 -0500

I'm sorry for the newbie question, but I'm a bit confused. I'm reading
about Delegats in Jesse Liberty's C# Programming book and, well, I'm
confused as to the motivation behind delegates. On the surface, they look
exactly like using interfaces in java, so why have another construct to
confuse things?

I know they work "like function pointers" but the whole reason I went to
java was to avoid pointers! And before java, I used VB, so pointers are not
something advantageous to me. And I understand delegates are how .net does
event driven coding, but why can't interfaces be used to accomplish the
samething?

Thanks for any advice.



Relevant Pages

  • Re: motivation behind delegates
    ... > exactly like using interfaces in java, so why have another construct to ... > confuse things? ... They make things a lot easier than interfaces: ... Multicast delegates act as a very convenient way to implement event ...
    (microsoft.public.dotnet.framework)
  • Re: Is Ruby On Rails, Delphis lost cousing?
    ... The closest analogue in Java is anonymous classes, ... Delegates as a first-class ... language feature alone makes me happier using it. ... Java Mustang does have some of this same functionality. ...
    (borland.public.delphi.non-technical)
  • Re: Delegates...?
    ... get round the fact that Java does not have delegates. ... presenter class which binds the two together. ... one uses inner classes in ...
    (comp.lang.java.programmer)
  • Re: Delegates are useful, and here is why (sample program)
    ... comes to virtual calls (in C++, calling a virtual function through a ... oriented" than C++ pointers to members reminds me of how, ... Java adepts complaned that delegates are "not object-oriented" ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: delegates equivalent
    ... > Whta is the simplest way to have something like multicast delegates ... > A Java interpretation for: ... where DisplayClass and PrintClass are ...
    (comp.lang.java.programmer)

Quantcast