views:

87

answers:

1

I guess there is no operator overloading in objective C. Exact function overloading as in C++ is not present.

In what way polymorphism is implemented in objective C?

+1  A: 

Messages are handled dynamically, which gives an equivalent to C++ virtual methods.

If the parent class has a message -doSomething and a child class re-implements -doSomething, regardless of the type of reference you have to the child object, calling [instance doSomething] will invoke the child's method.

I'm not sure what operator overloading has to do with polymorphism, but yes, operator overloading does not exist in Objective C.

codelark
Operator overloading is orthogonal to polymorphism. I'd also add that if you call `doSomething`, the receiver doesn't even have to be a subclass. It'll just work as long as the instance responds tot he method.
bbum
what do u mean by "orthogonal to"?
Krishnan
@codelark: I think that operator overloading is a from of polymorphism.
Krishnan