On Fri, Jan 1, 2010 at 11:15 PM, Michael Heuer wrote:
2. Java-style interface abstract classes, or multiple class inheritance
Or maybe Objective-C style protocols?
These work sorta like this:
(void) foo (int)bar: {
...
}
Which just says "this code will conform to the 'protocol1' and
'protocol2' protocols. Protocols are then sorta like Java interfaces;
they define the methods (with signatures) that the class must
implement and may implement. Much more flexible for a more dynamic
language. "Okay, I implemented foo, bar, and baz with the right
signatures, so I conform to the X protocol." Any class that implements
the required methods can then be used by any method that requires an
object confirm to the protocol - and the caller doesn't care what the
class is, just what it does. It can do anything else in addition it
wants to.
--- Joe M.