首页 > 其他 > 详细

1.4 面向对象的基本概念

时间:2019-01-20 10:13:52      阅读:196      评论:0      收藏:0      [点我收藏+]

类:CLass

对象:Object

类和对象的关系:先有鸡还是先有蛋

用对象来定义类,用类产生对象

在设计软件的时候,对象是不存在的

软件系统运行时,在内存中创建对象,类不存在于物理世界。

what is a Class、Object?

A class is a description of a set of of objects that share the same attributes , operations,relationships and semantics

对象是描述共享一组相同属性、操作、关系和行为的符。

An Object is an Instance created  from a class

对象是根据类创建的一个实例

An inatance‘s behaviour and information structure is defined in the class 实例的行为和信息结构是被类定义的

It‘s current state(values of instance variables) is defined by operations performed on it.对象当前的状态(实例变量的值)取决于作用于该对象的操作

软件的功能是如何完成的?

类

定义了对象群体的逻辑结构,包括属性和操作

系统运行时,类作为产生对象的模板,在物理层面是不存在的

对象

系统运行时必须为每一个需要的对象分配内存、保存数据

对象存在于物理层面,每个对象都有自己的数据空间(内存)

所有的对象共用同一块代码空间

消息

对象之间的一种交流手段

所有相关对象之间相互协作完成软件功能

类和对象小结

Everything is an object 每一样东西都是对象

A program is a bunch of objects telling each other what to do by sending messages 一个程序就是有一大群对象相互间通过发送消息告诉对方该做什么

each object has its own memory made up of other objects 每个对象都有自己的内存空间,里面存放了许多其他的对象

every object has a type

each object is an instace of a class,in which "class" is synoymous with "type"

all objects of a perticular type can receive the same messages

1.4 面向对象的基本概念

原文:https://www.cnblogs.com/mayZhou/p/10293936.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!