函数对象和函数指针以及委托之间的区别 [英] Difference between function object and function pointer and a delegate

查看:107
本文介绍了函数对象和函数指针以及委托之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

函数指针,函数对象和委托与lambda有什么区别?

解决方案

委托是一个变量,它包含对方法的引用或Lambda

Lambda是一种没有永久(可访问)名称的方法。



函数指针在C#中称为委托(和C或C ++中的函数指针一样工作。



函数对象是对我们可以用来设置Delegate值的方法的引用。


请关注这些链接。



http://stackoverflow.com/questions/208835/function-pointers-closures-and-lambda [ ^ ]



HTTP:// ddili.org/ders/d.en/lambda.html [ ^ ]

What is the difference between a function pointer, function object and a delegate and a lambda?

解决方案

A Delegate is a variable which holds a reference to a method or Lambda
A Lambda is a method that has no permanent (accessible) name.

A function pointer is called a Delegate in C# (and works the same as a function pointer in C or C++).

A function object is a reference to a method that we can use to set the value of a Delegate.


Please follow thease links.

http://stackoverflow.com/questions/208835/function-pointers-closures-and-lambda[^]

http://ddili.org/ders/d.en/lambda.html[^]


这篇关于函数对象和函数指针以及委托之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆