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.
精彩评论