Submit Search
Upload
OOP Basics
•
9 likes
•
1,865 views
CIB Egypt
Follow
Great Introduction to OOP
Read less
Read more
Technology
News & Politics
Report
Share
Report
Share
1 of 81
Recommended
Object-oriented concepts
Object-oriented concepts
BG Java EE Course
Basic concept of OOP's
Basic concept of OOP's
Prof. Dr. K. Adisesha
Principles and advantages of oop ppt
Principles and advantages of oop ppt
daxesh chauhan
Object Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
class and objects
class and objects
Payel Guria
Oop
Oop
志明 陳
1 unit (oops)
1 unit (oops)
Jay Patel
Introduction to oop
Introduction to oop
colleges
Recommended
Object-oriented concepts
Object-oriented concepts
BG Java EE Course
Basic concept of OOP's
Basic concept of OOP's
Prof. Dr. K. Adisesha
Principles and advantages of oop ppt
Principles and advantages of oop ppt
daxesh chauhan
Object Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
class and objects
class and objects
Payel Guria
Oop
Oop
志明 陳
1 unit (oops)
1 unit (oops)
Jay Patel
Introduction to oop
Introduction to oop
colleges
Characteristics of OOPS
Characteristics of OOPS
abhishek kumar
Object oriented programming
Object oriented programming
Amit Soni (CTFL)
Oops ppt
Oops ppt
abhayjuneja
OOP Introduction with java programming language
OOP Introduction with java programming language
Md.Al-imran Roton
Basic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
Java: The Complete Reference, Eleventh Edition
Java: The Complete Reference, Eleventh Edition
moxuji
Data types in java
Data types in java
HarshitaAshwani
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
CPD INDIA
Introduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
OOPS Basics With Example
OOPS Basics With Example
Thooyavan Venkatachalam
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
Object Oriented Programming Using C++
Object Oriented Programming Using C++
Muhammad Waqas
Principal of objected oriented programming
Principal of objected oriented programming
Rokonuzzaman Rony
Object and class relationships
Object and class relationships
Pooja mittal
Static Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
Introduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu
Object oriented programming concepts
Object oriented programming concepts
rahuld115
Class and object in C++
Class and object in C++
rprajat007
Basic oop concepts - C++
Basic oop concepts - C++
Aleena Varghese
Basic Data Types in C++
Basic Data Types in C++
Hridoy Bepari
Oop Overview
Oop Overview
phananhvu
Very short OOP Introduction
Very short OOP Introduction
Cristian G
More Related Content
What's hot
Characteristics of OOPS
Characteristics of OOPS
abhishek kumar
Object oriented programming
Object oriented programming
Amit Soni (CTFL)
Oops ppt
Oops ppt
abhayjuneja
OOP Introduction with java programming language
OOP Introduction with java programming language
Md.Al-imran Roton
Basic concepts of object oriented programming
Basic concepts of object oriented programming
Sachin Sharma
Java: The Complete Reference, Eleventh Edition
Java: The Complete Reference, Eleventh Edition
moxuji
Data types in java
Data types in java
HarshitaAshwani
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
CPD INDIA
Introduction to Object Oriented Programming
Introduction to Object Oriented Programming
Moutaz Haddara
OOPS Basics With Example
OOPS Basics With Example
Thooyavan Venkatachalam
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Muhammad Hammad Waseem
Object Oriented Programming Using C++
Object Oriented Programming Using C++
Muhammad Waqas
Principal of objected oriented programming
Principal of objected oriented programming
Rokonuzzaman Rony
Object and class relationships
Object and class relationships
Pooja mittal
Static Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
Introduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu
Object oriented programming concepts
Object oriented programming concepts
rahuld115
Class and object in C++
Class and object in C++
rprajat007
Basic oop concepts - C++
Basic oop concepts - C++
Aleena Varghese
Basic Data Types in C++
Basic Data Types in C++
Hridoy Bepari
What's hot
(20)
Characteristics of OOPS
Characteristics of OOPS
Object oriented programming
Object oriented programming
Oops ppt
Oops ppt
OOP Introduction with java programming language
OOP Introduction with java programming language
Basic concepts of object oriented programming
Basic concepts of object oriented programming
Java: The Complete Reference, Eleventh Edition
Java: The Complete Reference, Eleventh Edition
Data types in java
Data types in java
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
Introduction to Object Oriented Programming
Introduction to Object Oriented Programming
OOPS Basics With Example
OOPS Basics With Example
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
Object Oriented Programming Using C++
Object Oriented Programming Using C++
Principal of objected oriented programming
Principal of objected oriented programming
Object and class relationships
Object and class relationships
Static Data Members and Member Functions
Static Data Members and Member Functions
Introduction to Java Programming
Introduction to Java Programming
Object oriented programming concepts
Object oriented programming concepts
Class and object in C++
Class and object in C++
Basic oop concepts - C++
Basic oop concepts - C++
Basic Data Types in C++
Basic Data Types in C++
Viewers also liked
Oop Overview
Oop Overview
phananhvu
Very short OOP Introduction
Very short OOP Introduction
Cristian G
Unusual C# - OOP
Unusual C# - OOP
Medhat Dawoud
General OOP Concepts
General OOP Concepts
Praveen M Jigajinni
Ashish oot
Ashish oot
Ashish Agrawal
OOP vs COP
OOP vs COP
Gianluca Padovani
Total oop in c# dot net
Total oop in c# dot net
Muhammad Naveed
Clean Code: Chapter 3 Function
Clean Code: Chapter 3 Function
Kent Huang
Redis training for java software engineers
Redis training for java software engineers
Moshe Kaplan
Clean Code - How to write comprehensible code regarding cognitive abilities o...
Clean Code - How to write comprehensible code regarding cognitive abilities o...
Mario Gleichmann
Empathic Programming - How to write comprehensible code
Empathic Programming - How to write comprehensible code
Mario Gleichmann
Writing beautiful code with Java 8
Writing beautiful code with Java 8
Sergiu Mircea Indrie
Simply - OOP - Simply
Simply - OOP - Simply
Thomas Bahn
Clean Code Development
Clean Code Development
Peter Gfader
Oop concepts
Oop concepts
Ritu Mangla
Clean Code (Presentacion interna en Virtual Software)
Clean Code (Presentacion interna en Virtual Software)
jmiguel rodriguez
Clean Code
Clean Code
swaraj Patil
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Nikita Koksharov
C#, OOP introduction and examples
C#, OOP introduction and examples
agni_agbc
What does OOP stand for?
What does OOP stand for?
Colin Riley
Viewers also liked
(20)
Oop Overview
Oop Overview
Very short OOP Introduction
Very short OOP Introduction
Unusual C# - OOP
Unusual C# - OOP
General OOP Concepts
General OOP Concepts
Ashish oot
Ashish oot
OOP vs COP
OOP vs COP
Total oop in c# dot net
Total oop in c# dot net
Clean Code: Chapter 3 Function
Clean Code: Chapter 3 Function
Redis training for java software engineers
Redis training for java software engineers
Clean Code - How to write comprehensible code regarding cognitive abilities o...
Clean Code - How to write comprehensible code regarding cognitive abilities o...
Empathic Programming - How to write comprehensible code
Empathic Programming - How to write comprehensible code
Writing beautiful code with Java 8
Writing beautiful code with Java 8
Simply - OOP - Simply
Simply - OOP - Simply
Clean Code Development
Clean Code Development
Oop concepts
Oop concepts
Clean Code (Presentacion interna en Virtual Software)
Clean Code (Presentacion interna en Virtual Software)
Clean Code
Clean Code
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
Java data structures powered by Redis. Introduction to Redisson @ Redis Light...
C#, OOP introduction and examples
C#, OOP introduction and examples
What does OOP stand for?
What does OOP stand for?
Similar to OOP Basics
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-C
DataArt
Lecture 5.pptx
Lecture 5.pptx
AshutoshTrivedi30
introduction of Object oriented programming
introduction of Object oriented programming
RiturajJain8
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
Muhammad Hammad Waseem
Voyage by example
Voyage by example
ESUG
OOPS in Java
OOPS in Java
Zeeshan Khan
Object oriented java script
Object oriented java script
vivek p s
java - oop's in depth journey
java - oop's in depth journey
Sudharsan Selvaraj
Intro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-C
Andrew Rohn
Method Swizzling with Objective-C
Method Swizzling with Objective-C
AdamFallon4
OOP02-27022023-090456am.pptx
OOP02-27022023-090456am.pptx
uzairrrfr
OOPs fundamentals session for freshers in my office (Aug 5, 13)
OOPs fundamentals session for freshers in my office (Aug 5, 13)
Ashoka R K T
introduction_OO.pptx
introduction_OO.pptx
MonishaAb1
introduction_OO.pptx
introduction_OO.pptx
RohitRoy210643
unit 1 full ppt.pptx
unit 1 full ppt.pptx
thenmozhip8
07slide.ppt
07slide.ppt
NuurAxmed2
Javascript Prototypal Inheritance - Big Picture
Javascript Prototypal Inheritance - Big Picture
Manish Jangir
OOP in JS
OOP in JS
Eugene Lazutkin
Avoid memory leaks using unit tests - Swift Delhi Meetup - Chapter 15
Avoid memory leaks using unit tests - Swift Delhi Meetup - Chapter 15
Raunak Talwar
Introduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
Similar to OOP Basics
(20)
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-C
Lecture 5.pptx
Lecture 5.pptx
introduction of Object oriented programming
introduction of Object oriented programming
[OOP - Lec 04,05] Basic Building Blocks of OOP
[OOP - Lec 04,05] Basic Building Blocks of OOP
Voyage by example
Voyage by example
OOPS in Java
OOPS in Java
Object oriented java script
Object oriented java script
java - oop's in depth journey
java - oop's in depth journey
Intro to iOS: Object Oriented Programming and Objective-C
Intro to iOS: Object Oriented Programming and Objective-C
Method Swizzling with Objective-C
Method Swizzling with Objective-C
OOP02-27022023-090456am.pptx
OOP02-27022023-090456am.pptx
OOPs fundamentals session for freshers in my office (Aug 5, 13)
OOPs fundamentals session for freshers in my office (Aug 5, 13)
introduction_OO.pptx
introduction_OO.pptx
introduction_OO.pptx
introduction_OO.pptx
unit 1 full ppt.pptx
unit 1 full ppt.pptx
07slide.ppt
07slide.ppt
Javascript Prototypal Inheritance - Big Picture
Javascript Prototypal Inheritance - Big Picture
OOP in JS
OOP in JS
Avoid memory leaks using unit tests - Swift Delhi Meetup - Chapter 15
Avoid memory leaks using unit tests - Swift Delhi Meetup - Chapter 15
Introduction to OOP concepts
Introduction to OOP concepts
Recently uploaded
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
LoriGlavin3
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Curtis Poe
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Alfredo García Lavilla
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Precisely
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Pixlogix Infotech
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Mark Simos
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
DianaGray10
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
LoriGlavin3
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
gvaughan
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
UiPathCommunity
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Fwdays
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
NavinnSomaal
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
LoriGlavin3
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Rizwan Syed
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
BookNet Canada
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
MounikaPolabathina
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
Lonnie McRorey
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
BkGupta21
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Fwdays
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
Recently uploaded
(20)
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
OOP Basics
1.
Great Introduction to
OOP Prepared by : Tom Hunter Edited and Updated By:Mohamed Shahpoup Java I—Copyright © 2000 Tom Hunter
2.
1- Introduction. 2- What
is OOP. 3- OOP Vocabulary . 4- Creating Our First Class Object. 5- Using this Keyword. Java I—Copyright © 2000 Tom Hunter
3.
The Genius of
Using Objects • How did companies like Dell, Compaq and Gateway get so big? • They bought components from other companies and assembled the pieces into their products. Java I—Copyright © 2000 Tom Hunter
4.
The Genius of
Using Objects • Dell didn’t design its own motherboards. • Compaq didn’t engineer its own hard drives or operating systems. • They bought the pieces and let somebody else do the engineering. Java I—Copyright © 2000 Tom Hunter
5.
The Genius of
Using Objects • Dell, Compaq and Gateway let somebody else reinvent the power supply or the motherboard. • Object-Oriented programming is the same idea. • A program is composed of generic objects, with certain standard properties, and certain standard operations the objects can perform. Java I—Copyright © 2000 Tom Hunter
6.
The Genius of
Using Objects • Dell doesn’t care how the power supply works. • Dell cares if the power supply works. • How the power supply works is hidden and private. • Only the end result is visible. Java I—Copyright © 2000 Tom Hunter
7.
The Genius of
Using Objects • Dell is only exposed to the end result. • Most important is the power supply’s public face— the power. • Dell doesn’t care how it works internally. Java I—Copyright © 2000 Tom Hunter
8.
The Genius of
Using Objects • Likewise, in OOP, you only care about what the objects expose. • You can’t know how somebody else’s object works. Java I—Copyright © 2000 Tom Hunter
9.
The Genius of
Using Objects • You don’t care how the JOptionPane works. • You care about its public methods—its “interface”. You only care about its public methods ! Java I—Copyright © 2000 Tom Hunter
10.
The Genius of
Using Objects • In traditional procedural programming, you search for verbs in the problem definition. • In procedural programming, the verbs directly suggest procedures and then, lastly, you think of data variables to go with those procedures. Java I—Copyright © 2000 Tom Hunter
11.
The Genius of
Using Objects • In OOP, you put data structures first, and then look at the algorithms that operate on the data. Java I—Copyright © 2000 Tom Hunter
12.
The Genius of
Using Objects • The secret to effective OOP: Each object carries out a small set of related tasks. If an object needs a task done—but that task isn’t the job of that object—then that object asks another object to do the task. “If I can’t do it, then I’ll ask somebody who can.” Java I—Copyright © 2000 Tom Hunter
13.
The Genius of
Using Objects • Again, since the first object can’t do the task, it asks the second object to carry out the task. • In OOP jargon, we say: “A Client object sends a message to a Server object.” Java I—Copyright © 2000 Tom Hunter
14.
The Genius of
Using Objects • In OOP, one object must never directly manipulate the internal data of another object. encapsulation • Rather, all communication is through “messages”. (A message is another name for a method call.) Java I—Copyright © 2000 Tom Hunter
15.
The Genius of
Using Objects • When you design your object to hide how it handles requests... (messages / method calls) ...you make it easily reusable. Java I—Copyright © 2000 Tom Hunter
16.
The Genius of
Using Objects • When you see a Windows OS computer lock up, and you do a CTRL-ALT-DEL, the “Close Program” window that pops up might say: (Not Responding) • That message means that some Windows object is not responding to messages. • Some program called a method, but Windows failed to respond. (No surprise) Java I—Copyright © 2000 Tom Hunter
17.
OOP Vocabulary
Class Java I—Copyright © 2000 Tom Hunter
18.
OOP Vocabulary class • The
term class is the blueprint which the object is actually made, or “instantiated.” MyClass boop; boop = new MyClass(); We are now familiar with this: The first “MyClass boop; ” makes a reference called “boop.” Java I—Copyright © 2000 Tom Hunter
19.
OOP Vocabulary
MyClass boop; At this point, the reference called “boop” does not actually point to any existing object. Soon, it will point to an object of type MyClass, but now the object doesn’t exist. Java I—Copyright © 2000 Tom Hunter
20.
OOP Vocabulary
MyClass boop = new MyClass(); When this statement executes, the new keyword executes the default Constructor for MyClass, which actually creates an object in memory and assigns that reference to boop. The handle to that just-created object is given to the MyClass reference boop. Now boop points to the new MyClass object. Java I—Copyright © 2000 Tom Hunter
21.
state
behavior identity Java I—Copyright © 2000 Tom Hunter
22.
OOP Vocabulary state
behavior identity • Each object in OOP has three key characteristics: What? How? Who? Java I—Copyright © 2000 Tom Hunter
23.
OOP Vocabulary state
behavior identity • Key characteristics: (What) What is the object’s state? (How) What is the object’s behavior? (Who) What is the object’s identity? Java I—Copyright © 2000 Tom Hunter
24.
OOP Vocabulary state
behavior identity • All instances of a class have the same instance variables, but of course those variables have different values inside them. • The state—or current values—for an instance of a class, is called the “state” of that class. • The current values of those variables define the current situation or state of this instance of the class. Java I—Copyright © 2000 Tom Hunter
25.
OOP Vocabulary state
behavior identity • For example, if I have a class called HourlyEmployee, then it contains instance variables: first_name last_name soc_sec_number hourly_rate current_vacation_time Java I—Copyright © 2000 Tom Hunter
26.
OOP Vocabulary state
behavior identity • All objects that are instances of the same class share the same behavior. • They all have the same methods. Java I—Copyright © 2000 Tom Hunter
27.
OOP Vocabulary state
behavior identity • My class is: HourlyEmployee • All instances of this class have these methods: calculate_pay() setName() Methods getName() setSSN() getSSN() getVacationTime() setVacationTime() getHourlyRate() setHourlyRate() Java I—Copyright © 2000 Tom Hunter
28.
OOP Vocabulary state
behavior identity • My class is: HourlyEmployee • Every example, or instantiation, of this class has the same methods (behavior) available to it. Java I—Copyright © 2000 Tom Hunter
29.
OOP Vocabulary state
behavior identity • My class is: HourlyEmployee • Let’s instantiate HourlyEmployee : HourlyEmployee joseph; // empty reference. joseph = new HourlyEmployee(‘Joe’,’Smith’, ’598-22-7893’,’$10.00’,’22.25’); • Now, I have created an instance of the class HourlyEmployee. Java I—Copyright © 2000 Tom Hunter
30.
OOP Vocabulary state
behavior identity • My class is: HourlyEmployee • I have instantiated HourlyEmployee. • My instance is called joseph. • The identity of my instance is joseph. Java I—Copyright © 2000 Tom Hunter
31.
OOP Vocabulary state
behavior identity • The identity of my instance is joseph. • The state of my instance is: first_name = ‘Joe’ last_name = ’Smith’ soc_sec_number = ’598-22-7893’ hourly_rate = ’$10.00’ current_vacation_time = ’22.25’ • The behavior of my instance is: calculate_pay() setName() getName() setSSN() getSSN() Java I—Copyright © 2000 Tom Hunter
32.
OOP Vocabulary identity
for each of the three. Tell me the state behavior identity • Now, I will instantiate three objects: HourlyEmployee marie; marie = new HourlyEmployee(‘Mary’,’J.’, ’555-24-1516’,’$30.00’,’0’); HourlyEmployee theodore; theodore = new HourlyEmployee(‘Ted’,’L.’, ’681-22-9875’,’$10.00’,’22’); HourlyEmployee david; david = new HourlyEmployee(‘Dave’,’D.’, ’198-99-0098’,’$15.00’,’8’); Java I—Copyright © 2000 Tom Hunter
33.
OOP Vocabulary state
behavior identity • Identity is the reference to this instantiation. HourlyEmployee marie; marie = new HourlyEmployee(‘Mary’,’J.’, ’555-24-1516’,’$30.00’,’0’); HourlyEmployee theodore; theodore = new HourlyEmployee(‘Ted’,’L.’, ’681-22-9875’,’$10.00’,’22’); HourlyEmployee david; david = new HourlyEmployee(‘Dave’,’D.’, ’198-99-0098’,’$15.00’,’8’); Java I—Copyright © 2000 Tom Hunter
34.
OOP Vocabulary behaviors
for each of the three. Tell me the state behavior identity HourlyEmployee marie; marie = new HourlyEmployee(‘Mary’,’J.’, ’555-24-1516’,’$30.00’,’0’); HourlyEmployee theodore; theodore = new HourlyEmployee(‘Ted’,’L.’, ’681-22-9875’,’$10.00’,’22’); HourlyEmployee david; david = new HourlyEmployee(‘Dave’,’D.’, ’198-99-0098’,’$15.00’,’8’); Java I—Copyright © 2000 Tom Hunter
35.
OOP Vocabulary state
behavior identity • All three have the exact same behaviors. HourlyEmployee marie; marie = new HourlyEmployee(‘Mary’,’J.’, ’555-24-1516’,’$30.00’,’0’); HourlyEmployee theodore; theodore = new HourlyEmployee(‘Ted’,’L.’, ’681-22-9875’,’$10.00’,’22’); HourlyEmployee david; david = new HourlyEmployee(‘Dave’,’D.’, ’198-99-0098’,’$15.00’,’8’); Java I—Copyright © 2000 Tom Hunter
36.
OOP Vocabularythe state
for each of the three. Tell me state behavior identity HourlyEmployee marie; marie = new HourlyEmployee(‘Mary’,’J.’, ’555-24-1516’,’$30.00’,’0’); HourlyEmployee theodore; theodore = new HourlyEmployee(‘Ted’,’L.’, ’681-22-9875’,’$10.00’,’22’); HourlyEmployee david; david = new HourlyEmployee(‘Dave’,’D.’, ’198-99-0098’,’$15.00’,’8’); Java I—Copyright © 2000 Tom Hunter
37.
OOP Vocabulary state
behavior identity • The state of each instance is defined by its instance variables. HourlyEmployee marie; marie = new HourlyEmployee(‘Mary’,’J.’, ’555-24-1516’,’$30.00’,’0’); HourlyEmployee theodore; theodore = new HourlyEmployee(‘Ted’,’L.’, ’681-22-9875’,’$10.00’,’22’); HourlyEmployee david; david = new HourlyEmployee(‘Dave’,’D.’, ’198-99-0098’,’$15.00’,’8’); Java I—Copyright © 2000 Tom Hunter
38.
OOP Vocabulary state
behavior identity • The state of an instance can only be changed by going through its methods or behaviors. HourlyEmployee marie; marie = new HourlyEmployee(‘Mary’,’J.’, ’555-24-1516’,’$30.00’,’0’); marie.setSSN( ‘444-33-1264’ ); Java I—Copyright © 2000 Tom Hunter
39.
Class Scope
Java I—Copyright © 2000 Tom Hunter
40.
OOP Vocabulary
Class Scope • A class’s Instance variables and methods have a thing called “class scope.” • Within the class (within the scope of that class), class member variables are accessible by name. (static Members) • So, inside or outside of any method in that class, those instance variables can be reached from anywhere in the class. Java I—Copyright © 2000 Tom Hunter
41.
OOP Vocabulary
Class Scope • If a member variable has been (foolishly) declared public, then it can be accessed outside of the class by simply referencing as follows: ClassName.primitive_variable ClassName.Object_variable. • Another instance of this class has access to the instance variables in any other instance of this class. • You can use the instance identifier or the class name if it is declared as a “static” variable. Java I—Copyright © 2000 Tom Hunter
42.
Cosmic Base Class
Java I—Copyright © 2000 Tom Hunter
43.
OOP Vocabulary Cosmic
Base Class • In Java, all classes are built on other classes. • We say, that one class extends another class. • Ultimately, all classes in Java stem from one central “Cosmic Base Class” called Object. • Even if you didn’t use the word “extends” in your class definition, you were still always extending Object by default. Java I—Copyright © 2000 Tom Hunter
44.
OOP Vocabulary Base
Class • When you extend any “Base Class”, the new (derived) class has all the properties ( instance variables) and methods of its parent, or Base Class. • You can choose to modify or keep any method of the parent, or you can create methods that only apply to the child or “inherited” class. Java I—Copyright © 2000 Tom Hunter
45.
Inheritance
Java I—Copyright © 2000 Tom Hunter
46.
OOP Vocabulary Inheritance
• The concept of extending a base class is called “Inheritance.” • Inheritance is the second fundamental concept of Object-Oriented programming. (Encapsulation is the first, Polymorphism is the third) Java I—Copyright © 2000 Tom Hunter
47.
OOP Vocabulary Relationships
Between Classes • Classes can be related to each other in one of three alternative ways: use containment ( “has-a” ) inheritance ( “is-a” ) Java I—Copyright © 2000 Tom Hunter
48.
OOP Vocabulary •
When one class sends messages to another class, we say it “uses” the class that receives its messages. Use Java I—Copyright © 2000 Tom Hunter
49.
OOP Vocabulary •
When one class lives as an Instance Variable within another class, we say it is “Contained”, a “has-a” relationship. Containment ( “has-a” ) Java I—Copyright © 2000 Tom Hunter
50.
OOP Vocabulary •
When one class inherits from another class, we say it is an “is-a” relationship. inheritance ( “is-a” ) Java I—Copyright © 2000 Tom Hunter
51.
OOP Vocabulary Relationships
Between Classes: use • Imagine that we have a class Order. • Class Order needs to use the class Account, in order to check for credit status. Java I—Copyright © 2000 Tom Hunter
52.
OOP Vocabulary Relationships
Between Classes: use • Generally, if a method of class Order sends a message to an object of class Account, then Order uses Account. Account Order message • In other words, Order uses Account when Order calls methods of Account. Java I—Copyright © 2000 Tom Hunter
53.
OOP Vocabulary Relationships
Between Classes: use • Also, we say class Order uses class Account if: • A method of Order : creates receives or returns objects of class Account . Java I—Copyright © 2000 Tom Hunter
54.
OOP Vocabulary Relationships
Between Classes: use • Design Tip: Avoid the “use” relationship whenever you can. If you “use” somebody else’s class, then any changes to that class can break your class. Java I—Copyright © 2000 Tom Hunter
55.
OOP Vocabulary Relationships
Between Classes: containment • The “Containment” relationship (also known as the “Composition” relationship) is a special case of the “use” relationship. • In a Containment / Composition relationship, at least one method of one class actually contains an object of another class. Java I—Copyright © 2000 Tom Hunter
56.
OOP Vocabulary Relationships
Between Classes: containment ( In the use relationship, it calls methods of another object.) Account Order message ( In the containment relationship, it contains another object.) Order Account Java I—Copyright © 2000 Tom Hunter
57.
OOP Vocabulary Relationships
Between Classes: containment • In a “has-a” relationship, a class becomes an instance variable for the class we are defining. public class Order extends Object { Account acct = new Account(); Java I—Copyright © 2000 Tom Hunter
58.
OOP Vocabulary Relationships
Between Classes: inheritance • Inheritance means specialization. • When we inherit from a class, we wish to keep nearly everything in the base class (Superclass). • In inheritance, we seek to elaborate on what we receive from the Superclass. Java I—Copyright © 2000 Tom Hunter
59.
OOP Vocabulary Relationships
Between Classes: inheritance • We start with the class Order. • Then, we wish to create a Subclass off of Order. • Our Subclass is called RushOrder. Java I—Copyright © 2000 Tom Hunter
60.
OOP Vocabulary Relationships
Between Classes: inheritance • Class RushOrder has everything that Order has, but it: -adds a few instance variables, maybe -adds a method or two and -overrides a method or two. Java I—Copyright © 2000 Tom Hunter
61.
OOP Vocabulary Relationships
Between Classes • These three relationships between classes form the foundation of Object-Oriented Design. use “has-a” “is-a” Java I—Copyright © 2000 Tom Hunter
62.
Techniques
for Using Objects Java I—Copyright © 2000 Tom Hunter
63.
OOP Vocabulary Techniques
for Using Objects • We have spent a lot of time emphasizing the difference between a reference and the object to which it refers. JLabel howdy; howdy = new JLabel( “How Are Ya?” ); Java I—Copyright © 2000 Tom Hunter
64.
JLabel howdy; =
new JLabel( “How Are Ya?” ); howdy howdy “How are Ya?” • We start off by declaring a reference “howdy” to an object of type JLabel. • Then, we instantiate the object by calling its constructor with the new keyword, and assign the handle to this instantiation to the reference we declared: “howdy”. Java I—Copyright © 2000 Tom Hunter
65.
howdy = new
JLabel( “How Are Ya?” ); howdy hello “How are Ya?” • Okay, what happens when I do the following statement? JLabel hello; // A new reference hello = howdy; • Now, both references point to the exact same object. • Any changes made from howdy will be reflected in hello. Java I—Copyright © 2000 Tom Hunter
66.
Controlling
Access to Methods and Variables Java I—Copyright © 2000 Tom Hunter
67.
OOP Vocabulary Controlling
Access to Methods: public • public—this lets clients see the services (methods) the class provides (which means view the interface.) —The interface is the collective name for all the various methods that are available in the class. —Methods should be public. Java I—Copyright © 2000 Tom Hunter
68.
OOP Vocabulary Controlling
Access to Member Variables and Methods: public & private • private —It hides implementation details. — Private data members (variables) are only accessible through the public interface (Accessor methods) using public methods. (getter and Setter). Java I—Copyright © 2000 Tom Hunter
69.
OOP Vocabulary
Controlling Access to Member: package • package—if you don’t specify that a method or a data variable is either private or public, then when you have automatically given it package access. • If your program has only one class definition—this change is transparent. It has zero effect. H O W E V E R... Java I—Copyright © 2000 Tom Hunter
70.
OOP Vocabulary
Controlling Access to Member: package • if you don’t specify either public or private for any feature… [ meaning class, method or variable ] can be accessed by all methods in the same package! Java I—Copyright © 2000 Tom Hunter
71.
OOP Vocabulary Controlling
Access to Member: package • So, if you have the following field in your class: public class MyClass { int mySalary; … } … and your class is stored in java.util.*; then any other method in any class that is also stored in this package can change this variable to anything it wants. No methods needed! Java I—Copyright © 2000 Tom Hunter
72.
OOP Vocabulary Creating
a Package • A package is a way to organize classes. • Normally, you create a public class. • If you don’t define your class as public, then it’s only accessible to other classes in the same package. Java I—Copyright © 2000 Tom Hunter
73.
Access Levels Modifier
Class Package Subclass World Public Y Y Y Y Protected Y Y Y N no Y Y N N modifier Private Y N N N Java I—Copyright © 2000 Tom Hunter
74.
Objects Passed By
Reference Java I—Copyright © 2000 Tom Hunter
75.
Object-Based Programming Objects Passed
By Reference • As we know the name or reference for an object represents a memory location where the object is stored. • When an object is passed, only the reference is passed. Java I—Copyright © 2000 Tom Hunter
76.
Object-Based Programming Objects Passed
By Reference • That means, only the address of the object is passed. • A copy is NOT made of the object. • This will have interesting implications. Java I—Copyright © 2000 Tom Hunter
77.
Creating Our
First Class Object Class – Object – Constructor – static Java I—Copyright © 2000 Tom Hunter
78.
The this Reference
Java I—Copyright © 2000 Tom Hunter
79.
The this Reference •
You were sitting in your Ferrarri in your driveway. • Next door, your plumber neighbor was sitting in her Ferrarri. • If you wanted to refer to your neighbor’s Ferrarri, you would naturally say “Jane’s Ferrarri….” • Likewise, it would be perfectly natural for you to refer to the car you were sitting in as “this Ferrarri….” Java I—Copyright © 2000 Tom Hunter
80.
The this Reference •
“this Ferrarri….” • In Java, the this reference is used to refer to the object you are inside of at this moment. • We say that each object has a reference to itself—called the this reference. Java I—Copyright © 2000 Tom Hunter
81.
The this Reference •
The this reference is used to refer to both the instance variables and methods of an object. • In Event Handlers, we have used the this reference to show that this Applet (and by implication this Applet’s actionPerformed method) will listen for events from this object. • The this reference can also be used for cascading method calls which allow a reference to be passed back up the calling chain. Java I—Copyright © 2000 Tom Hunter
Editor's Notes
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters
White Space Characters