什么是代表?

发布于 2024-09-10 08:47:30 字数 121 浏览 0 评论 0原文

我正在目标 c 上编写一些东西,但我仍然不明白,我根本不知道/理解委托是什么。

也许因为我的主要编程语言是 C++ 和 Java...不知道。

我在网上搜索寻找英文解释,但是,似乎我不会说英语:)

I was coding some stuff on objetive c.. but I still dont get it, I dont know/understand what a delegate is at all.

Maybe cuz my main programming language is C++ and Java... dont know.

I searched the web looking for an ENGLISH explanation, but, seems like I dont speak english :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小傻瓜 2024-09-17 08:47:30

委托是一个对象的实例,它以面向对象的方式实现了一堆 C 程序员所谓的回调。像大多数新概念一样,它实际上只是一个旧约定的重命名和混淆。

维基百科上有一些很好的示例。

A delegate is an instance of an object that implements a bunch of what C programmers call callbacks, but in an object-oriented way. Like most new concepts, it is really just an old convention renamed and obfuscated.

There are some nice examples here on wikipedia.

寻找一个思念的角度 2024-09-17 08:47:30

在 Objective-C 中,委托是一个符合特定协议的对象,另一个对象可以依赖它来实现特定的功能。这与许多其他语言中的委托是一个不同的概念,并且可能会令人困惑,因为术语是相同的。

当我开始使用 Objective-C 编程时,我发现这篇文章非常有用:

http://developer.apple.com/mac/library/documentation/General/Conceptual/DevPedia-CocoaCore/Delegation.html

In Objective-C, a delegate is an object that conforms to a specific protocol, that another object can rely on for specific functionality. It's a different concept to delegation in lots of other languages, and it can get confusing because the terminology is the same.

Here's an article I found rather useful when I started programming in Objective-C:

http://developer.apple.com/mac/library/documentation/General/Conceptual/DevPedia-CocoaCore/Delegation.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文