1 OOP - An Introduction ISQS 6337 John R. Durrett.

Slides:



Advertisements
Similar presentations
When is Orientated Programming NOT? Mike Fitzpatrick.
Advertisements

Chapter 13 – Introduction to Classes
C++ Classes & Data Abstraction
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Object-Oriented PHP (1)
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Object Oriented Programming.  OOP Basic Principles  C++ Classes  September 2004  John Edgar 22.
Chapter Objectives You should be able to describe: Object-Based Programming Classes Constructors Examples Common Programming Errors.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
CS 2511 Fall Features of Object Oriented Technology  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance.
CS 2511 Fall  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance  Polymorphism.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
C++ fundamentals.
 By Wayne Cheng.  Introduction  Five Tenets  Terminology  The foundation of C++: Classes.
1 Review: Two Programming Paradigms Structural (Procedural) Object-Oriented PROGRAM PROGRAM FUNCTION OBJECT Operations Data OBJECT Operations Data OBJECT.
Introduction to C++. Overview C++? What are references Object orientation Classes Access specifiers Constructor/destructor Interface-implementation separation.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
Chapter 11: Inheritance and Composition. Objectives In this chapter, you will: – Learn about inheritance – Learn about derived and base classes – Redefine.
Chapter 4 Objects and Classes.
Introduction to Object-oriented programming and software development Lecture 1.
Module 7: Object-Oriented Programming in Visual Basic .NET
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Programming Languages and Paradigms Object-Oriented Programming.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Introduction To Classes Chapter Procedural And Object Oriented Programming Procedural programming focuses on the process/actions that occur in a.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Chapter 13. Procedural programming vs OOP  Procedural programming focuses on accomplishing tasks (“verbs” are important).  Object-oriented programming.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Chapter 10 Introduction to Classes
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
CSCI 1100/1202 April 1-3, Program Development The creation of software involves four basic activities: –establishing the requirements –creating.
Chapter 4&5 Defining Classes Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
2 Objectives You should be able to describe: Object-Based Programming Classes Constructors Examples Common Programming Errors.
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
CSci 162 Lecture 10 Martin van Bommel. Procedures vs Objects Procedural Programming –Centered on the procedures or actions that take place in a program.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Introduction to Object Oriented Programming (OOP) Object Oriented programming is method of programming.
1 CSE Programming in C++. 2 Overview Sign roster list Syllabus and Course Policies Introduction to C++ About Lab 1 Fill Questionnaire.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
Presented by Ted Higgins, SQL Server DBA An Introduction to Object – Oriented Programming.
YG - CS Concept of Encapsulation What is encapsulation? - data and functions/methods are packaged together in the class normally.
CSCI 171 Presentation 15 Introduction to Object–Oriented Programming (OOP) in C++
Structure A Data structure is a collection of variable which can be same or different types. You can refer to a structure as a single variable, and to.
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
Classes CS 162 (Summer 2009). Parts of a Class Instance Fields Methods.
Classes in C++ By: Mr. Jacobs. Objectives  Explore the implications of permitting programmers to define their own data types and then present C++ mechanism.
Classes (Part 1) Lecture 3
Classes C++ representation of an object
Module 5: Common Type System
Review: Two Programming Paradigms
Chapter 3: Using Methods, Classes, and Objects
About the Presentations
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
CS5253 Workshop I Lecturer: Dr. Lusheng Wang
CPS120: Introduction to Computer Science
Chapter 11: Inheritance and Composition
Classes C++ representation of an object
Object-Oriented PHP (1)
CPS120: Introduction to Computer Science
2.1 Introduction to Object-Oriented Programming
Object Oriented Programming(OOP)
Introduction to Computer Science and Object-Oriented Programming
Presentation transcript:

1 OOP - An Introduction ISQS 6337 John R. Durrett

Development Paradigms Increasing program complexity 1. Front panel switches 2. Assembly language 3. High level languages (3gl)(COBOL) 4. Structured Programming –reduce complex to simple parts –top down 5. OOP –self-contained == data + methods –inside out from classes

3 Top Down, procedure- oriented design steps Identify tasks (verbs) to perform Stepwise refinement (N. Wirth) –break task into sub-tasks until sub-tasks are simple enough to implement directly Write procedures to solve sub- tasks Combine simple procedures to create functionality required

4 Procedural Programming

5 OO design steps Identify objects (nouns) in environment Establish behavior and attributes in objects Identify relationships between objects Specify class/object interface & implementation

6 Object Oriented Programming

7 Classes & Objects Class –abstract pattern or template –“cookie cutter” –interface defining behavior –description of data & related operations Object –particular instance or specimen –“cookie” –instantiation of abstract class –definition of memory

8 Example: Integers Data (Attributes, fields, data members) –Integers Operations ( Methods, member funcs ) –Account_Balance() –Deposit() –Withdrawal() –Interest() All a user needs to care about is information input to operations and info returned

Encapsulation (information hiding) binds data & code together black box –no need for programmer to understand how methods are implemented fields are safe from outside interference –program never access data members –only access is through public methods –semi-global variables key is to make data private & provide public access methods –i.e. a well defined interface

10 C++ Access specifiers - control level of encapsulation All can contain data & methods public –available anywhere with scope –provide interface to private –like struct private –accessible only through public member methods protected –Just like private (for now) friend

Polymorphism one name many purposes – C: abs() labs() fabs() – C++ abs() one interface multiple methods function overloading operator overloading compile time polymorphism – int abs(int); – long abs(long); – float abs(float);

12 Methods Functions that are members of class & therefore available in objects interface to private data Constructors (next slide) Mutators Accessors Destructors

Initialization automatic initialization of member data Constructors C++ ex: class myclass { private:// default for class int a; public: myclass (int x); void show(); }; myclass::myclass(int x) { a = x; } void myclass::show(void) { cout << a; } void main(){ myclass ob(4); ob.show(); // ok ob.a = 12; // wrong! }

Inheritance one object acquires properties of another hierarchical classification single inheritance (Java) multiple inheritance (C++) class - abstract representation object - defined variable of class type

15 Operator Overloading Increased flexibility Increased ease of use Increased control of class actions Not in java Example Employee E1, E2; E1 = E2; cout << E1; Class-1.cpp example