




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、類和對(duì)象Class and Object關(guān)于對(duì)象式語(yǔ)言2022/8/6Institute of Computer Software, Nanjing University2本課程并不系統(tǒng)講授Eiffel語(yǔ)言但應(yīng)學(xué)會(huì)“欣賞” Eiffel 語(yǔ)言 (比較“純”)它首先是一個(gè)對(duì)象式程序設(shè)計(jì)語(yǔ)言但強(qiáng)調(diào)從分析到設(shè)計(jì)到實(shí)現(xiàn)的平滑過(guò)渡摘要2022/8/6Institute of Computer SoftwareNanjing University3三個(gè)世界: 面向?qū)ο蟮慕C嫦驅(qū)ο笤瓌t類:對(duì)象程序靜態(tài)的結(jié)構(gòu)對(duì)象:運(yùn)行時(shí)刻的結(jié)構(gòu)對(duì)象創(chuàng)建:從類到對(duì)象對(duì)象引用:對(duì)象串起來(lái)摘要三個(gè)世界: 面向?qū)ο蟮慕C嫦驅(qū)ο笤?/p>
2、則類:對(duì)象程序靜態(tài)的結(jié)構(gòu)對(duì)象:運(yùn)行時(shí)刻的結(jié)構(gòu)對(duì)象創(chuàng)建:從類到對(duì)象對(duì)象引用:對(duì)象串起來(lái)2022/8/6Institute of Computer Software, Nanjing University4三個(gè)世界2022/8/6Institute of Computer Software, Nanjing University5客觀世界 DVD播放機(jī)What is reality?復(fù)雜性 認(rèn)識(shí)的主觀性 問(wèn)題世界抽象!A model of a subset of the reality DVD播放機(jī)計(jì)算機(jī)(軟件)世界A model of a model of a subset of the rea
3、lity2022/8/662022/8/6Institute of Computer SoftwareNanjing University現(xiàn)實(shí)世界問(wèn)題世界軟件世界Reality抽象摘要2022/8/6Institute of Computer SoftwareNanjing University7三個(gè)世界: 面向?qū)ο蟮慕C嫦驅(qū)ο笤瓌t類:對(duì)象程序靜態(tài)的結(jié)構(gòu)對(duì)象:運(yùn)行時(shí)刻的結(jié)構(gòu)對(duì)象創(chuàng)建:從類到對(duì)象對(duì)象引用:對(duì)象串起來(lái)面向?qū)ο笤瓌t2022/8/6Institute of Computer Software, Nanjing University8Object OrientationEncapsul
4、ationAbstractionPolymorphismInheritance面向?qū)ο笤瓌t2022/8/6Institute of Computer Software, Nanjing University9Object OrientationEncapsulationAbstractionPolymorphismInheritance回顧:抽象數(shù)據(jù)類型2022/8/6Institute of Computer Software, Nanjing University10抽象數(shù)據(jù)類型(ADT):用數(shù)學(xué)方法定義對(duì)象集合和運(yùn)算集合,僅通過(guò)運(yùn)算的性質(zhì)刻畫(huà)數(shù)據(jù)對(duì)象,而獨(dú)立于計(jì)算機(jī)中可能的表示方法ADT
5、規(guī)約方法代數(shù)規(guī)范語(yǔ)法部分,公理部分ADT實(shí)現(xiàn)E1,E2,E3面向?qū)ο笤瓌t2022/8/6Institute of Computer Software, Nanjing University11Object OrientationEncapsulationAbstractionPolymorphismInheritance封裝2022/8/6Institute of Computer Software, Nanjing University12封裝是把過(guò)程和數(shù)據(jù)包圍起來(lái),對(duì)數(shù)據(jù)的訪問(wèn)只能通過(guò)已定義的界面。DVD播放機(jī)2022/8/6Institute of Computer SoftwareNa
6、njing University13封裝Professor Clark needs to be able to teach four classes in the next semester.SubmitFinalGrades()AcceptCourseOffering()TakeSabbatical()Professor ClarkSetMaxLoad()Name: J ClarkEmployee ID: 567138HireDate: 07/25/1991Status: TenuredDiscipline: FinanceMaxLoad:4SetMaxLoad(4)2022/8/6Inst
7、itute of Computer SoftwareNanjing University14封裝信息/實(shí)現(xiàn)隱藏InterfaceClientDeposit()Withdraw()Transfer()BalanceinsterestYTDOwnerAccount_number Deposit() Withdraw() Transfer() 2022/8/6Institute of Computer SoftwareNanjing University15封裝封裝使得對(duì)象在抽象所界定的范圍內(nèi)保持相對(duì)的獨(dú)立,從而保證對(duì)象設(shè)計(jì)和對(duì)象實(shí)施方法的可靠分離。設(shè)計(jì)者和使用者分離!封裝可以防止由于程序模塊之間的
8、互相依賴性而導(dǎo)致程序“不穩(wěn)定”不會(huì)因某個(gè)部分的修改而導(dǎo)致整個(gè)系統(tǒng)許多部分都發(fā)生改動(dòng)。封裝是相對(duì)的!不能也沒(méi)有必要阻止編程人員去查看實(shí)施細(xì)節(jié)。2022/8/6Institute of Computer SoftwareNanjing University16封裝 vs. 繼承矛盾嗎?No!封裝性主要指的是對(duì)象的封裝性,引入繼承機(jī)制后,對(duì)象仍然是封裝地很好的實(shí)體,其它對(duì)象與它通信只能發(fā)送消息。相似性:共享代碼!繼承:靜態(tài)共享代碼封裝:動(dòng)態(tài)共享代碼2022/8/6Institute of Computer SoftwareNanjing University17模塊化傳統(tǒng)的模塊劃分方法:要求組成的子
9、程序(模塊)有實(shí)際意義和明確的某個(gè)功能功能分解和結(jié)構(gòu)分解OO的模塊劃分目標(biāo):生成一組有助于降低系統(tǒng)開(kāi)發(fā)費(fèi)用的模塊,通過(guò)模塊劃分所得到的模塊應(yīng)該能夠保證可以獨(dú)立的生成和修改,每個(gè)模塊的結(jié)構(gòu)應(yīng)該足夠簡(jiǎn)單2022/8/6Institute of Computer SoftwareNanjing University18模塊化與抽象和封裝密切相關(guān)模塊的劃分是以抽象出來(lái)的對(duì)象的性質(zhì)和功能為依據(jù)的模塊是封裝得以實(shí)現(xiàn)的技術(shù)保障Booch:“模塊化是反映一個(gè)被分解成一組相關(guān)聯(lián)的松散結(jié)合模塊組成系統(tǒng)的一個(gè)特性?!蹦K化以模塊為基礎(chǔ)2022/8/6Institute of Computer SoftwareNan
10、jing University19模塊與類型的統(tǒng)一模塊是軟件分解的單元,是語(yǔ)法概念類型是某些動(dòng)態(tài)對(duì)象的靜態(tài)描述,是語(yǔ)義概念傳統(tǒng)語(yǔ)言 模塊與類型分離對(duì)象語(yǔ)言 模塊與類型統(tǒng)一類型:類是抽象數(shù)據(jù)類型的實(shí)現(xiàn)模塊:類是對(duì)象式程序的基本組成單元基于類的面向?qū)ο蟮恼Z(yǔ)言機(jī)制的強(qiáng)有力之處在于“類”統(tǒng)一了類型和模塊面向?qū)ο笤瓌t2022/8/6Institute of Computer Software, Nanjing University20Object OrientationEncapsulationAbstractionPolymorphismInheritance2022/8/6Institute of
11、Computer SoftwareNanjing University21層次性封裝性幫助隱藏細(xì)節(jié);模塊化使結(jié)構(gòu)更加有序,但仍然不夠!層次性是對(duì)抽象的排序和定位類結(jié)構(gòu)關(guān)系(“is a”)對(duì)象結(jié)構(gòu)關(guān)系(“part of”)實(shí)現(xiàn)方式繼承:子類,父類單繼承,多繼承聚合:擁有關(guān)系/組合關(guān)系2022/8/6Institute of Computer SoftwareNanjing University22繼承單繼承CheckingSavingsSuperclass (parent)SubclassesInheritance RelationshipAncestorDescendents2022/8/6I
12、nstitute of Computer SoftwareNanjing University23繼承多繼承Use multiple inheritance only when needed and always with caution!Multiple Inheritance2022/8/6Institute of Computer SoftwareNanjing University24繼承繼承 作為模塊擴(kuò)展機(jī)制,體現(xiàn)開(kāi)閉原則,較好地支持軟件的復(fù)用。繼承 作為類型特化機(jī)制,體現(xiàn)分類方法,更合理地支持子類型實(shí)現(xiàn)。繼承也是多態(tài)和動(dòng)態(tài)綁定機(jī)制的基礎(chǔ)。2022/8/6Institute of C
13、omputer SoftwareNanjing University25子類對(duì)父類的擴(kuò)展與特化繼承表達(dá)的是一種分類演繹的認(rèn)識(shí)方法“To program is to understand.” 特化:包含范圍變小,行為特殊化擴(kuò)展:增加新的操作重定義:改變行為2022/8/6Institute of Computer SoftwareNanjing University26The Open-Closed Principle (OCP)動(dòng)機(jī):軟件是變化的!開(kāi)閉原則:“Closed for Modification; Open for Extension”對(duì)修改關(guān)閉,對(duì)擴(kuò)展開(kāi)放!Why OCP? - 重
14、用How OCP? - 繼承The Open-Closed PrincipleModules should be open and closed.Definitions: Open module: May be extended. Closed module: Usable by clients. May be approved, baselined and (if program unit) compiled. The rationales are complementary: For closing a module (managers perspective): Clients need
15、 it now. For keeping modules open (developers perspective): One frequently overlooks aspects of the problem.2022/8/6Institute of Computer Software, Nanjing University27The Open-Closed Principle (1)Institute of Computer SoftwareNanjing UniversityACEDB2022/8/6The Open-Closed Principle (2)Institute of
16、Computer SoftwareNanjing UniversityACEDBFAGH I2022/8/6The Open-Closed Principle (3)Institute of Computer SoftwareNanjing UniversityACEDBFAGH I2022/8/62022/8/6Institute of Computer SoftwareNanjing University31Example面向?qū)ο笤瓌t2022/8/6Institute of Computer Software, Nanjing University32Object OrientationE
17、ncapsulationAbstractionPolymorphismInheritance2022/8/6Institute of Computer SoftwareNanjing University33多態(tài)多態(tài)性使指相同的操作或函數(shù)、過(guò)程可作用于多種類型的對(duì)象上并獲得不同的結(jié)果。不同的對(duì)象,收到同一消息可以產(chǎn)生不同的結(jié)果,這種現(xiàn)象稱為多態(tài)性。多態(tài)性允許每個(gè)對(duì)象以適合自身的方式去響應(yīng)共同的消息多態(tài)性增強(qiáng)了軟件的靈活性和重用性。2022/8/6Institute of Computer SoftwareNanjing University34多態(tài)ShapeCircleTriangleSqua
18、redraw()draw()draw()draw()public class Shapes public static Shape randShape() switch(int)(Math.random() * 3) default: case 0: return new Circle(); case 1: return new Square(); case 2: return new Triangle(); public static void main(String args) Shape s = new Shape3; / 向數(shù)組里添加類型 for(int i = 0; i s.leng
19、th; i+) si = randShape(); / 用多態(tài)的方法調(diào)用 for(int i = 0; i = 0end2022/8/6Institute of Computer Software, Nanjing University40類的構(gòu)成類名繼承關(guān)系成員術(shù)語(yǔ)分類2022/8/6Institute of Computer Software, Nanjing University41Abstract data type POINTx: POINT REALy: POINT REAL: POINT REAL: POINT REALClass POINT: Choose a represen
20、tation (polar, cartesian)In polar representation, and are attributes, x and y are routines.2022/8/6Institute of Computer Software, Nanjing University42yxA simple classclass POINT featurex, y: REAL- Point cartesian coordinatesmove (a, b: REAL) is- Move by a horizontally and by b vertically.dox := x +
21、 ay := y + bendscale (factor: REAL) is- Scale by factor.dox := factor * xy := factor * yend2022/8/6Institute of Computer Software, Nanjing University43Class POINT (contd)distance (p: POINT): REAL is- Distance to pdoResult := sqrt (x p.x)2 + (y p.y)2)endro: REAL is- Distance to origin (0, 0)doResult
22、:= sqrt (x2 + y2)endtheta: REAL is- Angle to horizontal axisdoendend2022/8/6Institute of Computer Software, Nanjing University44術(shù)語(yǔ)A class is an implementation of an abstract data type. Instances of the class may be created at run-time; they are objects. 類的實(shí)例在運(yùn)行時(shí)刻產(chǎn)生,他們是對(duì)象。Every object is an instance
23、of a class. 每個(gè)對(duì)象都是一個(gè)類的實(shí)例。Note:In a pure O-O language such as Eiffel and Smalltalk this is true even of basic objects such as integers etc. Not true in C+ or Java where such values have special status.2022/8/6Institute of Computer Software, Nanjing University45術(shù)語(yǔ)A class is characterized by features.
24、Features comprise attributes (representing data fields of instances of the class) and routines (operations on instances). Routines are subdivided into procedures (effect on the instance, no result) and functions (result, normally no effect). Every operation (routine or attribute call) is relative to
25、 a distinguished object, the current instance of the class. 2022/8/6Institute of Computer Software, Nanjing University46Feature categories by role2022/8/6Institute of Computer Software, Nanjing University47CommandQueryFeatureProcedureAttributeFunctionNo resultReturns resultComputationMemoryFeature c
26、ategories by implementation2022/8/6Institute of Computer Software, Nanjing University48ProcedureAttributeFunctionRoutineReturns resultNo resultMemoryComputationFeatureFeature categories2022/8/6Institute of Computer Software, Nanjing University49CommandQueryFeatureProcedureAttributeFunctionNo resultR
27、eturns resultComputationMemoryRoutineReturns resultNo resultMemoryComputationFeatureAlternative terminologyAttributes are also called instance variables or data member.Routines are also called methods, subprograms, or subroutines.Feature call applying a certain feature of a class to an instance of t
28、hat class is also called passing a message to that object.The notion of feature is particularly important as it provides a single term to cover both attributes and routines. It is often desirable not to specify whether a feature is an attribute or a routine as expressed by the Uniform Access princip
29、le.2022/8/6Institute of Computer Software, Nanjing University50回顧:Uniform Access 訪問(wèn)一致性原則客戶應(yīng)能以實(shí)現(xiàn)無(wú)關(guān)的方式訪問(wèn)模塊的功能,不管這個(gè)功能是通過(guò)存儲(chǔ)還是計(jì)算來(lái)實(shí)現(xiàn)的。Facilities managed by a module must be accessible to clients in the same way whether implemented by computation or storage.2022/8/6Institute of Computer Software, Nanjing U
30、niversity51Uniform Accessbalance = list_of_deposits.total list_of_withdrawals.total2022/8/6Institute of Computer SoftwareNanjing University52list_of_depositslist_of_withdrawalsbalancelist_of_depositslist_of_withdrawals(A2)(A1)Uniform access through feature callTo access a property of a point p1, the
31、 notation is the same regardless of the representation, e.g.p1.xwhich is applicable both in cartesian representation (x is an attribute) and in polar representation (x is a function without arguments). In the first case the feature call is a simple field access; in the second it causes a computation
32、 to be performed. There is no difference for clients (except possibly in terms of performance).2022/8/6Institute of Computer Software, Nanjing University53類的使用類的使用有兩種形式允引 (class A is a client of class B)繼承 (class A is a descendant of class B) Client and supplier a:S in CFeature calla.some_feature or
33、 a.some_feature() or infix operatorsSingle target principle2022/8/6Institute of Computer Software, Nanjing University54Use of the class in a client (1/5)class GRAPHICS featurep, q: POINT- Graphic pointssome_routine is- Use p and q.local u, v: REALdo- Creation instructionscreate pcreate qendend2022/8
34、/6Institute of Computer Software, Nanjing University550.00.0p(POINT)0.00.0q(POINT)Use of the class in a client (2/5)class GRAPHICS featurep, q: POINT- Graphic pointssome_routine is- Use p and q.local u, v: REALdo- Creation instructionscreate pcreate qp.move (4.0, -2.0)- Compare with Pascal, C, Ada:-
35、 Move (p, 4.0, -2.0)endend2022/8/6Institute of Computer Software, Nanjing University564.0-2.0p(POINT)0.00.0q(POINT)Use of the class in a client (3/5)class GRAPHICS featurep, q: POINT- Graphic pointssome_routine is- Use p and q.local u, v: REALdo- Creation instructionscreate pcreate qp.move (4.0, -2.
36、0)- Compare with Pascal, C, Ada:- Move (p, 4.0, -2.0)p.scale (0.5)endend2022/8/6Institute of Computer Software, Nanjing University572.0-1.0p(POINT)0.00.0q(POINT)Use of the class in a client (4/5)class GRAPHICS featurep, q: POINT- Graphic pointssome_routine is- Use p and q.local u, v: REALdo- Creatio
37、n instructionscreate pcreate qp.move (4.0, -2.0)- Compare with Pascal, C, Ada:- Move (p, 4.0, -2.0)p.scale (0.5)u := p.distance (q)v := p.xp := qendend2022/8/6Institute of Computer Software, Nanjing University582.0-1.0p(POINT)0.00.0q(POINT)Use of the class in a client (5/5)class GRAPHICS featurep, q
38、: POINT- Graphic pointssome_routine is- Use p and q.local u, v: REALdo- Creation instructionscreate pcreate qp.move (4.0, -2.0)- Compare with Pascal, C, Ada:- Move (p, 4.0, -2.0)p.scale (0.5)u := p.distance (q)v := p.xp := qp.scale (-3.0)endend2022/8/6Institute of Computer Software, Nanjing Universi
39、ty592.0-1.0p(POINT)0.00.0q(POINT)2022/8/6Institute of Computer SoftwareNanjing University60模塊與類型的統(tǒng)一從模塊的觀點(diǎn): Set of available services (features or methods). 從類型的觀點(diǎn): Description of set of possible run-time objects (its instances).如何做到?Every object is an instance of some class.Connection: The services
40、of the class, viewed as a module, are the operations applicable to the instances of the class, viewed as a type.Applying abstraction principlesPrivileges of a client C of a class A on an attribute attrib:Read access if attribute is exported.Assuming a1: AThen a1.attrib is an expression. 2022/8/6Inst
41、itute of Computer Software, Nanjing University61CAa1: AThe privileges of a client2022/8/6Institute of Computer Software, Nanjing University62SecretRead-onlyRead, restricted writeFull writeApplying abstraction principlesBeyond read access: full or restricted write, through exported procedures. Full w
42、rite privileges: set_attribute procedure, e.g. set_temperature (u: REAL) is- Set temperature value to u.dotemperature := uensuretemperature_set: temperature = uendClient will use e.g. x.set_temperature (21.5).2022/8/6Institute of Computer Software, Nanjing University63Other uses of a setter procedur
43、eset_temperature (u: REAL) is- Set temperature value to u.requirenot_under_minimum: u = -273not_above_maximum: u = 2000dotemperature := uupdate_databaseensuretemperature_set: temperature = uend2022/8/6Institute of Computer Software, Nanjing University64Delphi/C# “properties”Allowx.temperature := 21.
44、5if there is a “setter”:private int temperature_internal;public int temperatureget return temperature_internal; set temperature_internal = value;/. Other instructions; .2022/8/6Institute of Computer Software, Nanjing University65Information hiding2022/8/6Institute of Computer Software, Nanjing Unive
45、rsity66class A featuref .g .feature NONEh .feature B, Cj .feature A, B, CkendIn clients, with the declaration a1: A, we have: a1.f, a1.g: valid in any client a1.h: invalid anywhere (including in As own text). a1.j: valid only in B, C and their descendants(not valid in A!) a1.k: valid in B, C and the
46、ir descendants, as well as in A and its descendantsInformation hiding (contd)Information hiding only applies to use by clients, using dot notation or infix notation, as with a1.f (“Qualified calls”).Unqualified calls (within the class itself) are not subject to information hiding:class Afeature NONE
47、 h is - Does something.do . endfeature f is - Use h.do . hendend 2022/8/6Institute of Computer Software, Nanjing University67DVD播放機(jī)摘要2022/8/6Institute of Computer SoftwareNanjing University68三個(gè)世界: 面向?qū)ο蟮慕C嫦驅(qū)ο笤瓌t類:對(duì)象程序靜態(tài)的結(jié)構(gòu)對(duì)象:運(yùn)行時(shí)刻的結(jié)構(gòu)對(duì)象創(chuàng)建:從類到對(duì)象對(duì)象引用:對(duì)象串起來(lái)對(duì)象:系統(tǒng)的運(yùn)行結(jié)構(gòu)對(duì)象:A run-time instance of some class.某對(duì)
48、象O是某類C的(直接)實(shí)例O包含為C中定義的屬性(數(shù)據(jù)成員)當(dāng)前狀態(tài)(O的fields) 運(yùn)行規(guī)律類定義的行為面向?qū)ο蟮能浖到y(tǒng)運(yùn)行時(shí)由一組對(duì)象構(gòu)成。對(duì)象是對(duì)問(wèn)題域?qū)ο?,并進(jìn)而對(duì)現(xiàn)實(shí)對(duì)象的實(shí)現(xiàn),三種對(duì)象概念上的一致性與差異性 2022/8/6Institute of Computer Software, Nanjing University69DVD播放機(jī)對(duì)象有狀態(tài)The state of an object is one of the possible conditions in which an object may exist.The state of an object normall
49、y changes over time.2022/8/6Institute of Computer Software, Nanjing University70Name: J ClarkEmployee ID: 567138Date Hired: July 25, 1991Status: TenuredDiscipline: FinanceMaximum Course Load: 3 classesProfessor Clark對(duì)象有行為Behavior determines how an object acts and reacts.The visible behavior of an ob
50、ject is modeled by the set of messages it can respond to (operations the object can perform).2022/8/6Institute of Computer Software, Nanjing University71SubmitFinalGrades()AcceptCourseOffering()TakeSabbatical()SetMaxLoad()Name: J ClarkEmployee ID: 567138HireDate: 07/25/1991Status: TenuredDiscipline:
51、 FinanceMaxLoad: 3Professor Clark對(duì)象有標(biāo)識(shí)Each object has a unique identity, even if the state is identical to that of another object.2022/8/6Institute of Computer Software, Nanjing University72Professor “J Clark” teaches BiologyProfessor “J Clark” teaches Biology對(duì)象需要合作Objects are useless unless they ca
52、n collaborate together to solve a problem.Each object is responsible for its own behavior and status.No one object can carry out every responsibility on its own.How do objects interact with each other?They interact through messages.2022/8/6Institute of Computer Software, Nanjing University73對(duì)象 vs. 類
53、A class is an abstract definition of an object.It defines the structure and behavior of each object in the class.It serves as a template for creating objects Objects are grouped into classes.An object is an instance of a class.2022/8/6Institute of Computer Software, Nanjing University74ObjectsProfes
54、sor SmithProfessor MellonFrom Real WorldabstractingClass: ProfessorTo computer WorldinstancingObjects摘要2022/8/6Institute of Computer SoftwareNanjing University75三個(gè)世界: 面向?qū)ο蟮慕C嫦驅(qū)ο笤瓌t類:對(duì)象程序靜態(tài)的結(jié)構(gòu)對(duì)象:運(yùn)行時(shí)刻的結(jié)構(gòu)對(duì)象創(chuàng)建:從類到對(duì)象對(duì)象引用:對(duì)象串起來(lái)對(duì)象創(chuàng)建對(duì)象按需創(chuàng)建,顯式創(chuàng)建。傳統(tǒng)技術(shù)往往基于棧分配實(shí)體運(yùn)行時(shí)刻對(duì)象動(dòng)態(tài)結(jié)構(gòu)多變,而難以根據(jù)程序文本預(yù)測(cè)Eiffel 的對(duì)象創(chuàng)建基本創(chuàng)建基本創(chuàng)建 初始化fe
55、atureCreation procedures2022/8/6Institute of Computer Software, Nanjing University76Creating an objectWith the class POINT as given:my_point: POINT .create my_pointEffect of such a creation instruction:Allocate new object of the type declared for my_point.Initialize its fields to default values (0 f
56、or numbers, false for booleans, null for characters, void for references).Attach it to the instructions target, here my_point.2022/8/6Institute of Computer Software, Nanjing University77Specific creation proceduresclass POINT createmake_cartesian, make_polarfeature - Initializationmake_cartesian (a,
57、 b: REAL) is- Initialize to abscissa a, ordinate b.dox := ay := bendmake_polar .feature . The rest as before .2022/8/6Institute of Computer Software, Nanjing University78If there is a creation clauseCreation instructions must be “creation calls”, such ascreate my_point.make_polar (1, Pi/2)2022/8/6In
58、stitute of Computer Software, Nanjing University79If there is no creation clauseAn absent creation clause, as inclass POINT - No creation clausefeature The rest as before endis understood as one that would only list default_create, as if it had been writtenclass POINT createdefault_createfeature The rest as before endProcedure default_create is defined in ANY as doing nothing; any class can redefine it to provide proper default initializations.2022/8/6Institute of Computer Software, Nanjing University80Associated conventionThe notationcreate xis understood (if permitted) as an abbrevi
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 造船行業(yè)2025年度安全生產(chǎn)計(jì)劃
- 航空貨運(yùn)供貨方案及運(yùn)輸保障措施
- 電力工程智能化創(chuàng)優(yōu)計(jì)劃
- 三年級(jí)上冊(cè)地方課程教學(xué)計(jì)劃方案
- 小班班級(jí)家長(zhǎng)開(kāi)放日安排計(jì)劃
- 六年級(jí)語(yǔ)文上冊(cè)寫(xiě)作水平提升計(jì)劃
- 2025年秋季學(xué)校少先隊(duì)骨干培訓(xùn)計(jì)劃
- 電子政務(wù)軟件技術(shù)方案及質(zhì)量保證措施
- 蘇教版五年級(jí)上冊(cè)數(shù)學(xué)家校合作計(jì)劃
- 中小學(xué)禁煙控?zé)煭h(huán)境整治計(jì)劃
- 2025至2030中國(guó)智能物流行業(yè)發(fā)展趨勢(shì)分析與未來(lái)投資戰(zhàn)略咨詢研究報(bào)告
- 2025年臺(tái)江礦泉水分公司招聘筆試參考題庫(kù)含答案解析
- 涉密測(cè)繪成果管理制度
- 亮化日常管理制度
- 國(guó)家開(kāi)放大學(xué)《中國(guó)法律史》期末機(jī)考題庫(kù)
- 跨國(guó)公司研發(fā)管理
- 15《真理誕生于一百個(gè)問(wèn)號(hào)之后》第一課時(shí) 公開(kāi)課一等獎(jiǎng)創(chuàng)新教學(xué)設(shè)計(jì)及反思
- 福建省泉州市第五中學(xué)2025屆七下數(shù)學(xué)期末聯(lián)考試題含解析
- 遼寧郵政校招筆試題目及答案
- 職業(yè)技術(shù)學(xué)院衛(wèi)生信息管理專業(yè)人才培養(yǎng)方案
- 復(fù)旦大學(xué)全球供應(yīng)鏈研究中心:中國(guó)對(duì)外商品貿(mào)易及供應(yīng)鏈波動(dòng)指數(shù)
評(píng)論
0/150
提交評(píng)論