English 中文(简体)
立法者是否真正属于目标C的类别?
原标题:Is Delegators really Categories in Objective-C?

我不想理解非正式议定书,直到现在我知道非正式议定书是一类,但为什么立法者没有一类的名称?

例:

#import <Cocoa/Cocoa.h>

@class FileSystemNode;

@interface AppController : NSObject { // Where is the Category ????  
@private
    IBOutlet NSBrowser *_browser;
    FileSystemNode *_rootNode;
}

@end

Thanks.

问题回答

非正式议定书not“一类”。

如果某一类别符合议定书(例如@interface MyClass <My protocol>),则保证您能够按My protocol的要求,在该类别上采用所有方法。 (除非这一类别没有实际执行这些类别[联系人可以知道,由于有活力的约束力],这是一个方案错误和 lie,但情况通常并非如此)。

而另一方面,类别则允许你采用一种已经存在的类别,并采用新的方法加以推广(例如,在现有的<条码>类别中添加<>remove All Subviews方法)。


因此,各类别和议定书是相互对立的。





相关问题
C# delegate with string reference to c++ callback

I wrote a C# application that uses an unmanaged c++ dll via managed c++ dll. In the unmanaged dll, there s a callback that one of its params is std::string&. I can t seem to find the right way to ...

how to call anonymous delegate dynamically

I hava a delegate public delegate void Context(); And i had implemented it by anonymous method, public Context fakeHttpContext = () => { ... create fake ...

self.delegate = self; what s wrong in doing that?

self.delegate = self; what s wrong in doing that? and what is the correct way of doing it? Thanks, Nir. Code: (UITextField*)initWith:(id)sender:(float)X:(float)Y:(float)width:(float)hieght:(int)...

Compiler treatment of a Delegate

If i declare a delegate public delegate void firstDelegate(string str); firstDelegate handler = Strfunc; handler("Hello World"); .. static void Strfunc(string str) { Console....

Practical use of interface events [closed]

What is a good example of the power of interface events (declaring events inside interface)? Most of the times I have seen only public abstract methods inside interface.

Delegates in C#

I`m having some trouble in understanding how delegates in C# work. I have many code examples, but i still could not grasp it properly. Can someone explain it to me in "plain english"? Of course! ...

热门标签