no, delegates are typed

解决方案 »

  1.   

    两码子事。delegate相当于函数指针,只不过是安全的函数指针。
    C++的模板象是宏替换,大概也只有C++独有。
      

  2.   

    templates are different from macros, since the former is type-safe, the latter is notJava will have templates (generics) soon and .NET and C# will have it in the future releases
      

  3.   

    template我知道不是宏,但是象宏。
    我个人认为它的用处不大,除了增加了编译器的负担外,并不能减少多少代码。何况,Java和C#都有object作为所有对象的基类,那么object就可以作为任何类型处理。
      

  4.   

    那delegate的具体功能又是什么?顺便问一下:
    .NET到底是什么?存在于高级语言(C#等等)与操作系统之间?他起什么作用?
    那编译好的文件又如何能够在别的机器上执行而没有.NET架构?
      

  5.   

    那delegate的具体功能又是什么?
    Delegates are type-safe callbacks and are the mechanism to expose events in .NET.NET到底是什么?
    .NET = Common Language Runtime(CLR) + Framework Class Libraries(FCL) + .NET languages (C#, VB.NET, JScript.NET, ....)CLR sits on the top of 操作系统, it is like a virtual machine那编译好的文件又如何能够在别的机器上执行而没有.NET架构?
    You need to have .NET framework on 别的机器上 in order to run .NET applications
      

  6.   

    MS设计delegate的初衷应该只是为了实现event pattern。
    如果要在C++中找一个delegate功能最接近的东西,我觉得应该是STL functor。