1.4 面向对象的基本概念
類:CLass
對象:Object
類和對象的關(guān)系:先有雞還是先有蛋
用對象來定義類,用類產(chǎn)生對象
在設(shè)計(jì)軟件的時候,對象是不存在的
軟件系統(tǒng)運(yùn)行時,在內(nèi)存中創(chuàng)建對象,類不存在于物理世界。
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
對象是描述共享一組相同屬性、操作、關(guān)系和行為的符。
An Object is an Instance created? from a class
對象是根據(jù)類創(chuàng)建的一個實(shí)例
An inatance's behaviour and information structure is defined in the class 實(shí)例的行為和信息結(jié)構(gòu)是被類定義的
It's current state(values of instance variables) is defined by operations performed on it.對象當(dāng)前的狀態(tài)(實(shí)例變量的值)取決于作用于該對象的操作
軟件的功能是如何完成的?
類
定義了對象群體的邏輯結(jié)構(gòu),包括屬性和操作
系統(tǒng)運(yùn)行時,類作為產(chǎn)生對象的模板,在物理層面是不存在的
對象
系統(tǒng)運(yùn)行時必須為每一個需要的對象分配內(nèi)存、保存數(shù)據(jù)
對象存在于物理層面,每個對象都有自己的數(shù)據(jù)空間(內(nèi)存)
所有的對象共用同一塊代碼空間
消息
對象之間的一種交流手段
所有相關(guān)對象之間相互協(xié)作完成軟件功能
類和對象小結(jié)
Everything is an object 每一樣?xùn)|西都是對象
A program is a bunch of objects telling each other what to do by sending messages 一個程序就是有一大群對象相互間通過發(fā)送消息告訴對方該做什么
each object has its own memory made up of other objects 每個對象都有自己的內(nèi)存空間,里面存放了許多其他的對象
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
轉(zhuǎn)載于:https://www.cnblogs.com/mayZhou/p/10293936.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的1.4 面向对象的基本概念的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: docker安装教程-centos
- 下一篇: 创建型模式:抽象工厂