开发者

Polymorphism in objective C

I guess there is no operator 开发者_Go百科overloading in objective C. Exact function overloading as in C++ is not present.

In what way polymorphism is implemented in objective C?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜