Dynamic binding -- Qt's Signals and Slots vs Objective-C

d d at nomail.com
Thu Sep 28 05:05:09 PDT 2006


> Hmm... now this is strange, and it took a while for me to grasp it as
> well :). Lets take this one:
> [obj1 sendAction:[obj1 action] to:[obj1 target]]
> It is actually three method calls, two of them nested.
> [obj1 action] is calling obj1's method action, and that method returns a
> selector, a selector is a method.
> [obj1 target] is also a method call, but returning an object instance.

The best explanation is that Objective-C is modelled after Smalltalk. A
method in C might be:

int AddAToX(int& a, int x);

where as in Objective C it would be:

- (int) Add: (int) a To: (int) x;

where the Method signature is Add:To:. Smalltalk would use almost the same
structure.






More information about the Digitalmars-d mailing list