评论

  • 为什么看不到了
  • 来自于"The Objective-C 2.0 Programming Language"的89页
  • 第89页有这么一段话,想不明白,请指正!

    In general, methods in different classes that have the same selector (the same name) must also share the
    same return and argument types. This constraint is imposed by the compiler to allow dynamic binding.
    Because the class of a message receiver (and therefore class-specific details about the method it’s asked to
    perform), can’t be known at compile time, the compiler must treat all methods with the same name alike.
    When it prepares information on method return and argument types for the runtime system, it creates just
    one method description for each method selector.
    However, when a message is sent to a statically typed object, the class of the receiver is known by the
    compiler. The compiler has access to class-specific information about the methods. Therefore, the message
    is freed from the restrictions on its return and argument types
  • 游客不能浏览吗?