zoukankan      html  css  js  c++  java
  • 面向对象的几个概念

    ■ A class is a structure that represents an object’s type. An object refers to its class to
    get various information about itself, particularly what code to run to handle each
    action. Simple programs might have a handful of classes; moderately complex ones
    will have a couple of dozen. Objective- C style encourages developers to capitalize
    class names.
    ■ An object is structure containing values and a hidden pointer to its class. Running
    programs typically have hundreds or thousands of objects. Objective- C variables that
    refer to objects are typically not capitalized.
    ■ Instance is another word for “object.” For example, a circle object can also be
    called an instance of class Circle.
    ■ A message is an action that an object can perform. This is what you send to an object
    to tell it to do something. In the [shape draw] code, the draw message is sent to the
    shape object to tell it to draw itself. When an object receives a message, its class is
    consulted to find the proper code to run.
    ■ A method is code that runs in response to a message. A message, such as draw, can
    invoke different methods depending on the class of the object.
    ■ The method dispatcher is the mechanism used by Objective- C to divine which method
    will be executed in response to a particular message. We’ll get out our shovels and dig
    a lot more into the Objective- C method dispatch mechanism in the next chapter.

    另外适用于object-c的:

    The interface is the description of the features provided by a class of objects. For
    example, the interface for class Circle declares that circles can accept the draw
    message.

    The implementation is the code that makes the interface work. In our examples,
    the implementation for the circle object holds the code for drawing a circle on the
    screen. When you send the draw message to a circle object, you don’t know or care
    how the function works, just that it draws a circle on the screen.

  • 相关阅读:
    Swift学习一
    Swift开发学习(一):初始篇
    objc_msgSend arm64 崩溃问题
    更改navigationController push和pop界面切换动画
    iOS 改变UITextField中光标颜色
    IOS Core Animation Advanced Techniques的学习笔记(五)
    使用CAShapeLayer与UIBezierPath画出想要的图形
    亮相SIGGRAPH 太极拳三维教学App制作揭秘
    MySQL优化——索引
    求职前一个月复习知识
  • 原文地址:https://www.cnblogs.com/xiangshancuizhu/p/3384024.html
Copyright © 2011-2022 走看看