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.

  • 相关阅读:
    Go
    Go
    Go -11 Go 框架beego的简单 create run
    文本处理工具之:grep sed awk
    Linux系统布置java项目
    docker 启动mysql 本地连接
    time
    多行查询数据合并成一行进行展示
    settings的使用
    xlsxwriter
  • 原文地址:https://www.cnblogs.com/xiangshancuizhu/p/3384024.html
Copyright © 2011-2022 走看看