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
那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
C++的模板象是宏替换,大概也只有C++独有。
我个人认为它的用处不大,除了增加了编译器的负担外,并不能减少多少代码。何况,Java和C#都有object作为所有对象的基类,那么object就可以作为任何类型处理。
.NET到底是什么?存在于高级语言(C#等等)与操作系统之间?他起什么作用?
那编译好的文件又如何能够在别的机器上执行而没有.NET架构?
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
如果要在C++中找一个delegate功能最接近的东西,我觉得应该是STL functor。