RK-
RK-

Reputation: 12211

Polymorphism in objective C

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?

Upvotes: 1

Views: 4838

Answers (1)

codelark
codelark

Reputation: 12334

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.

Upvotes: 4

Related Questions