第 5 章 面向对象基础

110
第 5 第 第第第第第第 4 第第

Upload: cruz

Post on 11-Feb-2016

148 views

Category:

Documents


0 download

DESCRIPTION

第 5 章 面向对象基础. 4 学时. 引言. 话说三国时期,曹操带领百万大军攻打东吴,大军在长江赤壁驻扎,军船连成一片,眼看就要灭掉东吴,统一天下,曹操大悦,于是大宴众文武,在酒席间,曹操诗性大发,不觉吟道: “ 喝酒唱歌,人生真爽。 ……” 。众文武齐呼: “ 丞相好诗! ” 于是一臣子速命印刷工匠刻版印刷,以便流传天下。 . 曹操感觉不妥: “ 喝与唱,此话过俗,应改为 ‘ 对酒当歌 ’ , 工匠眼看连夜刻版之工,彻底白费,心中叫苦不喋 , 只得照办。. 喝酒唱歌 人生真爽. 喝酒当歌 人生真爽. 唱 当. - PowerPoint PPT Presentation

TRANSCRIPT

  • 5 4

  • ,,

  • , ,;,,,,,,,,,,

  • 5 12UML34UML55UML

  • 5 5.1 5.2 5.3 5.4 UML 5.5 5.6 5.7 5.8 5.9 5.10 5.11

  • 5.1 , , ,4

  • input comput output

    /"AB"NumberANumberBOperateNumberANumberBOperate

    /NumberANumberBOperateString Result = "";Switch(Operate){case "+": Result =string(NumberA + NumberB);break;case "": Result =string(NumberA NumberB);break;case "*": Result =string(NumberA NumberB);break;case "/": if (NumberB!= "0")Result =string(NumberA NumberB);else Result = "0"break;}Result

    /ResultConsole.WriteLine(": " + Result);

  • operation,numberAnumberBNumberA()NumberB()GetResult()

  • operOperationAdd,NumberANumberBGetResultOperation oper;oper = OperationFactory. createOperate("+") ;oper.NumberA = 1; oper.NumberB =2;double.result = oper.GetResult();,switch

  • 5.2

  • ,,:=,=J20080101,=08-1,,

  • ,()

  • CPUCPUUSB,,

  • ,,,,,,,,

  • ,,Shape,1deaw();3CircleSquareTriangleShapedraw()

  • class Shape{ void draw(){} //draw() }

    class Circle extends Shape{ void draw() {Systemoutprintln(Circle")}}

    class Square extends Shape{ void draw() {Systemoutprintln(Square)} } class Triangle extends Shape{void draw() { Systemoutprintln("Triangle)}}Shape[] s = new Shape[3];//3s[0]=new Circle() //s[1]=new Square()//s[2]=new Triangle()//for(int i=0i

  • 5.3 Booch, Coad/Yourdon, OMTOOSE

  • BoochGrady Booch1983,1991Booch

  • Booch ,(),,

  • Coad1989Peter CoadEd Yourdon :,,,

  • OOSEIvar Jacobson1992,:,,:,,,, ,,

  • OMTLoomisShanRumbaugh19871991OMTOMT3OMT4(+)(+)(+)()

  • 5.4 UMLBoochRumbaughJacobsonUMLUML1.0(19971)UML1.1(199711)19971117OMGUML1.12003OMGUML2.0

  • UML

  • View,,

  • --

    ,

  • ,

  • UMLUML99

  • RUPRUPRational Unified Process,Rational

  • RationalRational

  • 5.5

  • 5.5

  • UML

  • ,

  • ATM

    include

    include

    include

  • UMLextend

    extend

  • ABABABABAB

  • 1 2

  • 1234

  • 1

  • 5.6

  • /

  • 123

  • 5.7 1)2)3)

  • []/

    /

    /

    []/

    []/

    []/

    []/

    []/

    []/

  • []/

  • 5.8

  • UML

  • 1.2.3.

    4.5.6.

  • 5.9

  • ( )GET( )( )( )

  • PublicPrivateProtectedUML+-#

  • {}

  • 1)2)3)4)5)

  • UML: () : {}

  • UML GetAddrCustomerNoStringString+ GetAddrCustomerNoPublicPrivateProtectedUML+-#

  • Form

  • UML

  • 5.10 PCC/SB/S

  • *

    PC

    *

    TCP/IP

    TCP/IP

    TCP/IP

    Sonicwall

    Cisco C2924M -XL

    PC

    PC

    /

    PC

    A3000

    A2000 WEB

  • 5.11.java-

  • .Java

    -

  • find.exedbacs.dllnateng.dllfind.htmlfind.exeindex.htmlfind.html

  • 5.12 Rational ROSEIBM UMLRational ROSEUMLUMLC++JavaVisual Basic IDLDDLRational ROSE/UML

  • Rational ROSEUMLUse CaseActivitySequenceCollaborationClassStatechartComponentDeploymentRational ROSE

  • UML,UML59

    **************************************************************