1.4 面向对象的基本概念

类: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

猜你喜欢

转载自www.cnblogs.com/mayZhou/p/10293936.html
1.4
今日推荐