Object Oriented Programming. Problem Description “ …customers are allowed to have different types of bank accounts, deposit money, withdraw money and.

Slides:



Advertisements
Similar presentations
Object Oriented Programming. Object Oriented Data and operations are grouped together Account Withdraw Deposit Transfer Interface: Set of available operations.
Advertisements

4. Object-Oriented Programming Procedural programming Structs and objects Object-oriented programming Concepts and terminology Related keywords.
Object Oriented Programming. Problem Description “ …customers are allowed to have different types of bank accounts, deposit money, withdraw money and.
Object Oriented Programming Teguh Sutanto Si | STIKOM Surabaya
CS 106 Introduction to Computer Science I 04 / 11 / 2008 Instructor: Michael Eckmann.
Inheritance Part I. Lecture Objectives To learn about inheritance To understand how to inherit and override superclass methods To be able to invoke superclass.
I NHERITANCE Chapter 10. I NHERITANCE Mechanism for enhancing existing classes You need to implement a new class You have an existing class that represents.
OBJECT-ORIENTED PROGRAMMING. What is an “object”? Abstract entity that contains data and actions Attributes (characteristics) and methods (functions)
Department of computer science N. Harika. Inheritance Inheritance is a fundamental Object Oriented concept A class can be defined as a "subclass" of another.
1 Classes Object-oriented programming: Model the problem as a collection of objects that have certain attributes and interact with one another and/or the.
Ch 12: Object-Oriented Analysis
Course Description: Title : Object Oriented Systems
ACM/JETT Workshop - August 4-5, :Inheritance and Interfaces.
1 Using Classes and Working With Class Interfaces November 20, 2002 CSE103 - Penn State University Prepared by Doug Hogan.
Object Oriented Programming | Website for students | VTU NOTES.
9. Inheritance 9.1 Subclasses 9.2 Polymorphism 9.3 Abstract Classes 9.4 Modifiers and Access 9.6 Object-Oriented Design with Use Cases and Scenarios.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Unit 4II 1 More about classes H Defining classes revisited H Constructors H Defining methods and passing parameters H Visibility modifiers and encapsulation.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CS 106 Introduction to Computer Science I 11 / 19 / 2007 Instructor: Michael Eckmann.
Lecture 13: Object- Oriented Concepts Anita S. Malik Adapted from Schach (2004) Chapter 7.
ISE 582: Web Technology for Industrial Engineers University of Southern California Department of Industrial and Systems Engineering Lecture 4 JAVA Cup.
OOP in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
ACM/JETT Workshop - August 4-5, Object-Oriented Basics & Design.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
Inheritance. © 2004 Pearson Addison-Wesley. All rights reserved 8-2 Inheritance Inheritance is a fundamental object-oriented design technique used to.
BACS 287 Basics of Object-Oriented Programming 1.
Inheritance One of the biggest advantages of object-oriented design is that of inheritance. A class may be derived from another class, the base class.
Inheritance using Java
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Module 7: Essentials of Object-Oriented Programming.
CS 106 Introduction to Computer Science I 04 / 13 / 2007 Friday the 13 th Instructor: Michael Eckmann.
1 A Student Guide to Object- Orientated Systems Chapter 4 Objects and Classes: the basic concepts.
OBJECT AND CLASES: THE BASIC CONCEPTS Pertemuan 8 Matakuliah: Konsep object-oriented Tahun: 2009.
Module 7: Object-Oriented Programming in Visual Basic .NET
An Object-Oriented Approach to Programming Logic and Design
OBJECT ORIENTED PROGRAMMING CONCEPTS ISC 560. Object-oriented Concepts  Objects – things names with nouns  Classes – classifications (groups) of similar.
CSE 501N Fall ‘09 15: Polymorphism October 22, 2009 Nick Leidenfrost.
Object Oriented Programming April 13, Problem Description “ …Wombats are allowed to have different directions and number of eaten leaves, move,
Inheritance in Java. RHS – SOC 2 What is inheritance (in Java)? Inheritance is a mechanism for enhancing existing classes What does that mean…? Defining.
Inheritance Building one object from another. Background Object-oriented programming is normally described has offering three capabilities Encapsulation:
1 Inheritance Chapter 9. 2 What You Will Learn Software reusability (Recycling) Inheriting data members and functions from previously defined classes.
Information Systems Engineering
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Learners Support Publications Object Oriented Programming.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
9-Dec Dec-15  INTRODUCTION.  FEATURES OF OOP.  ORGANIZATION OF DATA & FUNCTION IN OOP.  OOP’S DESIGN.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
INFSY 535.  Small systems  Larger systems 1.Understand the program requirement- what 3. Write and test each part (unit testing) 4. Maintenance 2. Specify.
Inheritance and Subclasses CS 21a. 6/28/2004 Copyright 2004, by the authors of these slides, and Ateneo de Manila University. All rights reserved L16:
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Computer Programming 2 Lecture 8: Object Oriented Programming Creating Classes & Objects Prepared & Presented by: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION.
// Java2101.java This program tests the features of the class. public class Java2101 { public static void main (String args[]) { System.out.println("\nJAVA2101.JAVA\n");
72 4/11/98 CSE 143 Abstract Data Types [Sections , ]
Classes CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Monday, Jan 27, 2003Kate Gregory with material from Deitel and Deitel Week 4 Questions from Last Week Hand in Lab 2 Classes.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
Computing with C# and the .NET Framework
Object Oriented Analysis and Design
Software Design Lecture : 12.
Object Oriented Programming
CS100J Lecture 7 Previous Lecture This Lecture Java Constructs
By Rajanikanth B OOP Concepts By Rajanikanth B
Programming Paradigms
By Rajanikanth B Classes in Java By Rajanikanth B
Presentation transcript:

Object Oriented Programming

Problem Description “ …customers are allowed to have different types of bank accounts, deposit money, withdraw money and transfer money between accounts”

Procedural Approach bool MakeDeposit(int accountNum,float amount); float Withdraw(int accountNum,float amount); struct Account { char *name; int accountNum; float balance; char accountType; };

Procedural Approach cont’d Focus is on procedures All data is shared: no protection More difficult to modify Hard to manage complexity

Procedural vs. Object-Oriented Procedural Withdraw, deposit, transfer Object Oriented Customer, money, account

Mapping the world to software Objects in the problem domain are mapped to objects in software

Object Oriented Data and operations are grouped together Account Withdraw Deposit Transfer Interface: Set of available operations

Data Encapsulation class Account { public: float withdraw(); void deposit(float amount); private: float balance; );

Advantages of Encapsulation Protection Consistency Allows change

Objects and Classes Classes reflect concepts, objects reflect instances that embody those concepts. Daria Jane Brittany Jodie girl class object

Objects and Classes cont’d A class captures the common properties of the objects instantiated from it A class characterizes the common behavior of all the objects that are its instances

Objects and Classes cont’d Class BankAccount Balance InterestYTD Owner Account_number Balance 500 InterestYTD Owner Account_number Balance 10,000 InterestYTD Owner Account_number Operations MakeDesposit Transfer WithDraw GetBalance

Objects as instances of Classes The world conceptually consists of objects Many objects can be said to be of the same type or class My bank account, your bank account, Bill Gates’ bank account … We call the object type a class

Instantiation An Object is instantiated from a Class BankAccount myAccount; myAccount = new BankAccount;

Objects and Classes Class Visible in source code The code is not duplicated Object Own copy of data Active in running program Occupies memory Has the set of operations given in the class

Classification Mammal RodentPrimateCats Reptile Animal SquirelRabbitMouse

Classification Enjoy a variety of personal banking options from First American. The following outlines a number of First American products. If you have any questions, please visit any First American Branch or contact us.contact us Checking Bank a lot without spending a lot: ValueFirst ® Checking.ValueFirst ® Checking Few checks and prefer PC Banking or ATMs: Select Access.Select Access Earn interest on checking dollars: First Interest CheckingFirst Interest Checking You are 55 years or better: 55 & Better Silver55 & Better Silver Premium checking features with higher interest rates than a personal checking account: First American Platinum CheckingFirst American Platinum Checking Write less than 10 checks per month, or bank through an ATM: Budget Checking.Budget Checking Younger than 24 years old and in school: Student CheckingStudent Checking Less than 20 transactions per month (excluding ATM, POS, and CheckCard): First AccountFirst Account Make the most out of every dollar: Tailored Money SweepTailored Money Sweep

Classification Checking Account Value FirstSelect AccessFirst Interest Savings Account Account

Inheritance A class which is a subtype of a more general class is said to be inherited from it. The sub-class inherits the base class’ data members and member functions

Inheritance cont’d A sub-class has all data members of its base-class plus its own A sub-class has all member functions of its base class (with changes) plus its own Inheritance is meant to implement sub- typing (don’t abuse it)

Abstraction Management of complexity Hierarchical classification: is-a relationship: inheritance has-a relationship: containment

Polymorphism One interface Multiple implementations Inheritance Method overloading

What is a good class ? A class abstracts objects A class should be non-trivial in the context of the program (has data structures and operations different from other classes)

Summary What is Object Oriented Programming? Object-oriented programming is a method of implementation in which programs are organized as cooperative collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships