zoukankan      html  css  js  c++  java
  • C++程序设计-面向对象

    1-1面向对象初探
    变量也是Object
    Data: the properties  or status; is the core
    Operations: the functions对外能提供的服务,给灯通电或者不通电。
                               map
    Problem space --------------Solution space
     
    object  oriented(00)
    是一种组织  设计 和实现的思想(Designs&Implementations)
     
    2-2 面向对象基本概念
    对象之间通过message进行信息交换
    Object send messages
      Messages are
        Composed by the sender
        Interpreted by the receiver
        Implemented by the methods
      Messages
        May cause receiver to change state
        May return the result
     
    Object vs.Class
      Object(cat)
            Represent things,events ,or concepts
            Respond to message at run-time
      Class(cat class)
        Define properties of instances
            Act like types in C++
     
    OOP Characteristics
      1.Evertything is an objetct.
      2.A program is a bunch of objects telling each other what to do by sending messages.
      3.Each Object has its own memory make up of other objects.
      4.Every object has a type.
      5.All objects of a particular type can receive the same messages.
     
    An object has an interface
      The interface is the way it receives messages.
      It is defined in the class the object belong to.
     
    Functions of the interface
      如果有借口,那么可以很方便的换其他东西,做出在程序中可以拆换的东西
      耦合-内聚,耦合性大是我们希望做到的。
      Communication:与外界进行沟通。
      Protection;如果有借口,就可以保护内部的Implementations,外边的借口了还是不变的。
     
    The Hidden Implementation(隐藏实现)
      Inner part of an object, data members to present its state, and the actions it takes
      when messages is rcvd is hidden.
    Class creators Vs. Client programmers
      -Keep client programmer's hand off portions they should not touch.
      -Allow the class creators to change the interval working of the class without   worrying how it will affect the client programmers.
     
    Encapsulation(封装)
      bundle data and methods dealing with these data together in an object
      Hide the details of the data and action.
      Restrict only access to the publicized methods.
    晚来一阵风兼雨
  • 相关阅读:
    Git配置文件
    Python操作Excel表格概括
    字符串时间转换为格式化时间
    windows 安装pip 及更换pip国内源
    JS数组遍历的方法汇总
    python文件读写操作(r/r+/rb/w/w+/wb/a/a+/ab)
    【Offer】Kafka面试题总结
    netdata开源Linux系统监控系统安装:配置项详解
    netdata开源Linux系统监控系统安装:一句话满足你的要求
    nginx配置禁特定路径下的反向代理
  • 原文地址:https://www.cnblogs.com/dejunwang/p/4791178.html
Copyright © 2011-2022 走看看