CHAP14 - Chapter 14 Object-Oriented Software Development...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Chapter 14 Object-Oriented Software Development Dale/Weems/Headington
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Chapter 14 Topics Structured Programming vs. Object-Oriented Programming Using Inheritance to Create a New C++ class Type Using Composition (Containment) to Create a New C++ class Type Static vs. Dynamic Binding of Operations to Objects Virtual Member Functions
Background image of page 2
3 Two Programming Paradigms Structural (Procedural) Object-Oriented PROGRAM PROGRAM FUNCTION FUNCTION FUNCTION OBJECT Operations Data OBJECT Operations Data OBJECT Operations Data
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Object-Oriented Programming Language Features 1. Data abstraction 2. Inheritance of properties 3. Dynamic binding of operations to objects
Background image of page 4
5 OOP Terms C++ Equivalents Object Class object or class instance Instance variable Private data member Method Public member function Message passing Function call ( to a public member function )
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 What is an object? OBJECT Operations Data set of methods (public member functions) internal state (values of private data members)
Background image of page 6
7 Inheritance Hierarchy Among Vehicles vehicle wheeled vehicle boat bicycle car four-door two-door Every car is a wheeled vehicle.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Inheritance is a mechanism by which one class acquires (inherits) the properties (both data and operations) of another class the class being inherited from is the Base Class (Superclass) the class that inherits is the Derived Class (Subclass) the derived class is then specialized by adding properties specific to it
Background image of page 8
9 class Time Specification // SPECIFICATION FILE ( time.h ) class Time { public : void Set ( int hours , int minutes , int seconds ) ; void Increment ( ) ; void Write ( ) const ; Time ( int initHrs, int initMins, int initSecs ) ; // constructor Time ( ) ; // default constructor private : int hrs ; int mins ; int secs ; } ;
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Class Interface Diagram Private data: hrs mins secs Set Increment Write Time Time Time class
Background image of page 10
11 Using Inheritance to Add Features // SPECIFICATION FILE ( exttime.h) #include “time.h” enum ZoneType {EST, CST, MST, PST, EDT, CDT, MDT, PDT } ; class ExtTime : public Time // Time is the base class { public : void Set ( int hours, int minutes, int seconds , ZoneType
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/13/2011 for the course CSC 240 taught by Professor Lebre during the Spring '04 term at Moraine Valley Community College.

Page1 / 32

CHAP14 - Chapter 14 Object-Oriented Software Development...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online