SlideShare a Scribd company logo
1 of 23
Download to read offline
Object Oriented
Programming
Learning Outcome
● On successful completion of this module,
○ Explain the fundamentals of Object-Oriented Programming concepts
○ Design Object-Oriented based applications
○ Develop Object-Oriented applications
Lesson -1 : fundamentals of Object-Oriented
Programming
Toady’s Aim
● Explain the fundamentals of Object-Oriented Programming
○ Understand and describe OOP
○ Understand and describe OOP concepts
■ Inheritance
■ Aptraction
■ Encapsulation
■ Polymorphism
Good Programming
● more code not necessarily a good thing
● measure good programmers by the amount of functionality
● code can be used many times but only has to be debugged once!
● Code should be
○ often self-contained
○ used to break up code
○ intended to be reusable
○ keep code organized
○ keep code coherent
Problem to Solution
Object:
● A specific real world entity
● Objects have all the attributes specified in the class definition
● An object is an instance of a concept
○ 1234 is an instance of an int
○ "hello" is an instance of a string
Class:
● Specifies the characteristics of an entity but is not an instance of that entity
● A class is a blueprint or template that defines the structure of the object.
Format:
public class <name of class>
{
attributes
methods
}
Example:
public class Employee {
private int name; // Attribute - stores the name of the employee
public void sayName() // Method - prints the name of the employee
{
System.out.println("My name is " + name);
}
}
Activity: What is the value of X?
public class Calculator{
int x = 10;
public static void main(String[] args) {
Calculator myObj = new Calculator();
myObj.x = 25; // x is now 25
System.out.println(myObj.x);
}
}
Attributes
Method
Object
○ Inheritance
○ Abstraction
○ Encapsulation
○ Polymorphism
What are the Concepts in OOP?
Inheritance
● Inheritance is a fundamental concept in object-oriented programming (OOP)
that allows a class to inherit properties and behaviors from another class.
● Inheritance represents the IS-A relationship which is also known as a parent-
child relationship
● It enables code reuse and promotes the organization and hierarchy of classes.
○ Sub Class/Child Class: Subclass is a class which inherits the other class. It is also called a
derived class, extended class, or child class.
○ Super Class/Parent Class: Superclass is the class from where a subclass inherits the features. It
is also called a base class or a parent class.
Real world example of inheritance
Example of inheritance
class Employee{
float salary=80000;
}
class Programmer extends Employee{
int bonus=30000;
public static void main(String args[]){
Programmer p=new Programmer();
System.out.println("Programmer salary is:"+p.salary);
System.out.println("Bonus of Programmer is:"+p.bonus);
}
}
Activity
● Identify the differences between all 5 types of the inheritance ?
● Find the examples for each type of inheritance?
Types of the inheritance
Encapsulation
● "sensitive" data is hidden from users
● way of hiding the implementation details of a class from outside access and
only exposing a public interface that can be used to interact with the class.
● encapsulation is achieved by declaring the instance variables of a class as
private,
class Person {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) { this.age = age; }
}
public class Display{
public static void main(String[] args)
{
Person person = new Person();
person.setName("John");
person.setAge(30);
System.out.println("Name: " + person.getName());
System.out.println("Age: " + person.getAge());
}
}
Activity
● Find the Access Modifier?
Are we achieved our aim?
○ Understand, identify and describe Classes, Objects, Properties and Methods
○ Understand and describe OOP concepts
■ Inheritance
■ Encapulation
Reference

More Related Content

Similar to Object Oriented Programming

OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdf
HouseMusica
 
Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
BalamuruganV28
 

Similar to Object Oriented Programming (20)

Boston Startup School - OO Design
Boston Startup School - OO DesignBoston Startup School - OO Design
Boston Startup School - OO Design
 
Oop ppt
Oop pptOop ppt
Oop ppt
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdf
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
 
UNIT III (8).pptx
UNIT III (8).pptxUNIT III (8).pptx
UNIT III (8).pptx
 
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering CollegeObject Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
Object Oriented PHP by Dr.C.R.Dhivyaa Kongu Engineering College
 
Oops in java
Oops in javaOops in java
Oops in java
 
PHP- Introduction to Object Oriented PHP
PHP-  Introduction to Object Oriented PHPPHP-  Introduction to Object Oriented PHP
PHP- Introduction to Object Oriented PHP
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
 
Object Oriented Programming Constructors & Destructors
Object Oriented Programming  Constructors &  DestructorsObject Oriented Programming  Constructors &  Destructors
Object Oriented Programming Constructors & Destructors
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
 
Object Oriented Programming All Unit Notes
Object Oriented Programming All Unit NotesObject Oriented Programming All Unit Notes
Object Oriented Programming All Unit Notes
 
Concepts of OOPs
Concepts of OOPsConcepts of OOPs
Concepts of OOPs
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 

Recently uploaded

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 

Recently uploaded (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

Object Oriented Programming

  • 2. Learning Outcome ● On successful completion of this module, ○ Explain the fundamentals of Object-Oriented Programming concepts ○ Design Object-Oriented based applications ○ Develop Object-Oriented applications
  • 3. Lesson -1 : fundamentals of Object-Oriented Programming
  • 4. Toady’s Aim ● Explain the fundamentals of Object-Oriented Programming ○ Understand and describe OOP ○ Understand and describe OOP concepts ■ Inheritance ■ Aptraction ■ Encapsulation ■ Polymorphism
  • 5. Good Programming ● more code not necessarily a good thing ● measure good programmers by the amount of functionality ● code can be used many times but only has to be debugged once! ● Code should be ○ often self-contained ○ used to break up code ○ intended to be reusable ○ keep code organized ○ keep code coherent
  • 6.
  • 8.
  • 9. Object: ● A specific real world entity ● Objects have all the attributes specified in the class definition ● An object is an instance of a concept ○ 1234 is an instance of an int ○ "hello" is an instance of a string
  • 10. Class: ● Specifies the characteristics of an entity but is not an instance of that entity ● A class is a blueprint or template that defines the structure of the object.
  • 11. Format: public class <name of class> { attributes methods } Example: public class Employee { private int name; // Attribute - stores the name of the employee public void sayName() // Method - prints the name of the employee { System.out.println("My name is " + name); } }
  • 12. Activity: What is the value of X? public class Calculator{ int x = 10; public static void main(String[] args) { Calculator myObj = new Calculator(); myObj.x = 25; // x is now 25 System.out.println(myObj.x); } } Attributes Method Object
  • 13. ○ Inheritance ○ Abstraction ○ Encapsulation ○ Polymorphism What are the Concepts in OOP?
  • 14. Inheritance ● Inheritance is a fundamental concept in object-oriented programming (OOP) that allows a class to inherit properties and behaviors from another class. ● Inheritance represents the IS-A relationship which is also known as a parent- child relationship ● It enables code reuse and promotes the organization and hierarchy of classes. ○ Sub Class/Child Class: Subclass is a class which inherits the other class. It is also called a derived class, extended class, or child class. ○ Super Class/Parent Class: Superclass is the class from where a subclass inherits the features. It is also called a base class or a parent class.
  • 15. Real world example of inheritance
  • 16. Example of inheritance class Employee{ float salary=80000; } class Programmer extends Employee{ int bonus=30000; public static void main(String args[]){ Programmer p=new Programmer(); System.out.println("Programmer salary is:"+p.salary); System.out.println("Bonus of Programmer is:"+p.bonus); } }
  • 17. Activity ● Identify the differences between all 5 types of the inheritance ? ● Find the examples for each type of inheritance?
  • 18. Types of the inheritance
  • 19. Encapsulation ● "sensitive" data is hidden from users ● way of hiding the implementation details of a class from outside access and only exposing a public interface that can be used to interact with the class. ● encapsulation is achieved by declaring the instance variables of a class as private,
  • 20. class Person { private String name; private int age; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } public class Display{ public static void main(String[] args) { Person person = new Person(); person.setName("John"); person.setAge(30); System.out.println("Name: " + person.getName()); System.out.println("Age: " + person.getAge()); } }
  • 21. Activity ● Find the Access Modifier?
  • 22. Are we achieved our aim? ○ Understand, identify and describe Classes, Objects, Properties and Methods ○ Understand and describe OOP concepts ■ Inheritance ■ Encapulation