6579803-block-3

Upload: borisg3

Post on 02-Jun-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 6579803-Block-3

    1/19

    Fujitsu Computer Systems

    OO Programming

    Fujitsu Software Corporation

    Customer Training Series

    Presented by:

    Tim OBrienSenior Systems EngineerFujitsu Software Corporation

  • 8/11/2019 6579803-Block-3

    2/19

    PAGE 2 Fujitsu Computer Systems

    Intro to Object Oriented COBOL

    Discussion of OO ConceptsObjectsMethodsEncapsulationInheritance

    olymorphismroperties

    !ttributes Classes

  • 8/11/2019 6579803-Block-3

    3/19

    PAGE 3 Fujitsu Computer Systems

    Intro to Object Oriented COBOL (Cont)

    Create a simple "ello #orld CO$O% Class

    Discussion of OO CO$O% Synta&

    Create a multi'class OO CO$O% !pplication

  • 8/11/2019 6579803-Block-3

    4/19

    PAGE 4 Fujitsu Computer Systems

    OO Concepts C!asses

    Classes are collections of Objects that ha(e commonattributes and beha(iors

    !bstract Classes are Classes that do not necessarilycorrespond to specific real world objects) They are more

    li*e templates

    Objects are instantiated from Classes

    ! Class can typically be thought of as a factory thatproduces Objects at +untime

  • 8/11/2019 6579803-Block-3

    5/19

    PAGE " Fujitsu Computer Systems

    OO Concepts # Objects

    !n object is a software component , an instanceof a program

    !n object typically has data and methods

    !n object may ha(e properties and-or attributes

  • 8/11/2019 6579803-Block-3

    6/19

  • 8/11/2019 6579803-Block-3

    7/19PAGE % Fujitsu Computer Systems

    OO Concepts &et'ods

    Methods are li*e functions or subroutines , li*emini programs within a program

    Methods may accept and-or return parameters.data/

    Methods are In(o*ed .called/ using messages

  • 8/11/2019 6579803-Block-3

    8/19PAGE Fujitsu Computer Systems

    OO Concepts &et'ods (Cont)

    Method rototypes are used to define interfacesinto other Objects and-or to aid the compiler andruntime system to perform conformancechec*ing

  • 8/11/2019 6579803-Block-3

    9/19PAGE Fujitsu Computer Systems

    OO Concepts Properties

    ! roperty is a fi&ed data item with a welldefined format which can only be retrie(edand-or set

    In OO CO$O%0 roperties are both internallyand e&ternally a(ailable . ublic/ by default

  • 8/11/2019 6579803-Block-3

    10/19PAGE *+ Fujitsu Computer Systems

    OO Concepts Attrib,tes

    !n !ttribute is a declarati(e that may bespecified or 1ueried at runtime

  • 8/11/2019 6579803-Block-3

    11/19PAGE ** Fujitsu Computer Systems

    OO Concepts An Object andEncaps,!ation -iagram

    D!T!

    Method !

    M e t h o

    d $

    M e t h o

    d C

  • 8/11/2019 6579803-Block-3

    12/19PAGE *2 Fujitsu Computer Systems

    OO Concepts In'eritance

    Inheritance allows programmers to reuse codeand may dramatically decrease the time re1uiredto create new applications

    Inheritance is supported in Object CO$O%) Thismeans a child class may inherit from a parentclass0 thus combining functionality

  • 8/11/2019 6579803-Block-3

    13/19PAGE *3 Fujitsu Computer Systems

    -isc,ssion o. OO Concepts In'eritance -iagram

    D!T!

    Method !

    M e t h o d

    $ M e t h

    o d C D!T!

    Method !

    M e t h o d $ M

    e t h o

    d C

    Method D

  • 8/11/2019 6579803-Block-3

    14/19PAGE *4 Fujitsu Computer Systems

    OO Concepts Po!/morp'ism

    olymorphism allows programmers to inheritfrom classes0 but to alter .customi2e/ inheritedclasses for specific usage needs

    3sing olymorphism0 the same method namemay perform slightly different operations ondifferent objects in different circumstances

  • 8/11/2019 6579803-Block-3

    15/19PAGE *" Fujitsu Computer Systems

    OO Concepts Po!/morp'ism -iagram

    D!T!

    Method !

    M e t h o d

    $ M e t h

    o d C D!T!

    Method !

    & e t ' o d

    B 0

    M e t h o

    d C

    Method D

  • 8/11/2019 6579803-Block-3

    16/19

    PAGE *$ Fujitsu Computer Systems

    1 e!!o or!d COBOL C!ass

    Create a new CO$O% roject in 4isualStudio )5ET

    !dd a new class

    Code the class to display 6"ello #orld7$uild and debug the application

  • 8/11/2019 6579803-Block-3

    17/19

    PAGE *% Fujitsu Computer Systems

    OO COBOL 5/nta6

    Creating CO$O% Classes

    Creating roperties

    Creating Methods

    3sing e&isting CO$O% synta&In(o*ing CO$O% Classes

  • 8/11/2019 6579803-Block-3

    18/19

  • 8/11/2019 6579803-Block-3

    19/19

    PAGE * Fujitsu Computer Systems

    7,estions