OOP
(Object Oriented Programming)
https://htree.plus/
Presented By,
Nisarg Raval
Kadam Parikh
Kishan Sakariya
Ria Jain
What is OOP & 4-pillar?
❏ Object-oriented programming
(OOP) is a programming language
model in which programs are
organized around data, or objects,
rather than functions and logic.
https://htree.plus/
Encapsulation
Inheritance
Polymorphism AbstractionOOP
(4-pillar)
https://htree.plus/
Inheritance
❏ Concepts at higher levels are more general.
❏ Concepts at lower levels are more specific (inherit properties of
concepts at higher levels)
Vehicle
Wheeled Vehicle Boat
Car Bicycle
Inheritance
(By Programming)
https://htree.plus/
❏ The language mechanism by which one class acquires the
properties (data and operations) of another class
❏ Base Class (or superclass): the class being inherited from
❏ Derived Class (or subclass): the class that inherits
https://htree.plus/
❏ You can reuse the methods and data of the existing class
❏ You can extend the existing class by adding new data and new
methods
❏ You can modify the existing class by overloading its methods
with your own implementations
Advantages Of Inheritance
https://htree.plus/
Abstraction
❏ Objects in an OOP language provide an abstraction that hides
the internal implementation details.
❏ Abstraction refers to the concept of hiding the complexities of
a system from the users of that system
Abstraction
(Real World Example)
● For example, the coffee machine in your kitchen, you just
need to know which methods of the object are available to
call and which input parameters are needed to trigger a
specific operation. But you don’t need to understand how
this method is implemented and which kinds of actions it
has to perform to create the expected result.
Abstraction
(By Programming)
using namespace std;
class implementAbstraction
{
private:
int a, b;
public:
// method to set values of
// private members
void set(int x, int y)
{
a = x;
b = y;
}
void display()
{
cout<<"a = " <<a << endl;
cout<<"b = " << b << endl;
}
};
int main()
{
implementAbstraction obj;
obj.set(10, 20);
obj.display();
return 0;
}
https://htree.plus/
Encapsulation
❏ Encapsulation is a process of combining
data members and functions in a single
unit called class.
https://htree.plus/
Encapsulation
(Example)
❏ using System;
❏ namespace OPPs {
❏ class Encapsulation {
❏ private string Name = "Alex";
❏ public string EmployeeName { // Property
❏ get {
❏ return Name;
❏ }
❏ set {
❏ Name = value;
❏ }
❏ }
❏ static void Main(string[] args) {
❏ string Name2 = string.Empty;
❏ // use properties
❏ Encapsulation e = new Encapsulation();
❏ Name2 = e.EmployeeName;
❏ Console.WriteLine("Employee Name: " + Name2);
❏ Console.ReadLine();
❏ }
❏ }
❏ }
https://htree.plus/
Advantages Of
Encapsulation & Abstraction
❏ Encapsulation helps us in binding the data(instance
variables) and the member functions(that work on the
instance variables) of a class.
❏ Abstraction helps the user to avoid writing the low level code
❏ Abstraction avoids code duplication and increases
reusability.
❏ Abstraction can change internal implementation of class
independently without affecting the user.
https://htree.plus/
Polymorphism
(By Real World Example)
● The word ‘polymorphism’ literally means ‘a state of having
many shapes’ or ‘the capacity to take on different forms’.
https://htree.plus/
Polymorphism
(By Programming)
❏ Two types of polymorphism :
- Dynamic Polymorphism
- Static Polymorphism
❏ The process of binding the overloaded method within object at
compile time is known as Static polymorphism
❏ In dynamic polymorphism method of the program binds with
an object at runtime
https://htree.plus/
Polymorphism
(By Progamming)
https://htree.plus/
Advantages Of Polymorphism
❏ It helps programmers reuse the code and classes once written,
tested and implemented. They can be reused in many ways.
❏ Single variable name can be used to store variables of multiple
data types(Float, double, Long, Int etc).
❏ Polymorphism helps in reducing the coupling between
different functionalities.
References
❏ https://medium.com/omarelgabrys-blog/the-story-of-object-oriented-programming-
12d1901a1825
❏ https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html
❏ http://cs.smu.ca/~porter/csc/465/notes/oop.html
❏ https://atomicobject.com/resources/oo-programming/oo-quality
❏ https://medium.com/from-the-scratch/oop-everything-you-need-to-know-about-object-
oriented-programming-aee3c18e281b
❏ https://www.javatpoint.com/java-oops-concepts
❏ https://tomassetti.me/oops-concepts/
❏ http://www.differencebetween.net/technology/difference-between-oop-and-pop/
❏ https://en.wikipedia.org/wiki/Object-oriented_programming
❏ https://en.wikipedia.org/wiki/Access_modifiers
https://htree.plus/
THANK YOU
https://htree.plus/

Opps Concept

  • 1.
    OOP (Object Oriented Programming) https://htree.plus/ PresentedBy, Nisarg Raval Kadam Parikh Kishan Sakariya Ria Jain
  • 2.
    What is OOP& 4-pillar? ❏ Object-oriented programming (OOP) is a programming language model in which programs are organized around data, or objects, rather than functions and logic. https://htree.plus/ Encapsulation Inheritance Polymorphism AbstractionOOP (4-pillar)
  • 3.
    https://htree.plus/ Inheritance ❏ Concepts athigher levels are more general. ❏ Concepts at lower levels are more specific (inherit properties of concepts at higher levels) Vehicle Wheeled Vehicle Boat Car Bicycle
  • 4.
    Inheritance (By Programming) https://htree.plus/ ❏ Thelanguage mechanism by which one class acquires the properties (data and operations) of another class ❏ Base Class (or superclass): the class being inherited from ❏ Derived Class (or subclass): the class that inherits
  • 5.
    https://htree.plus/ ❏ You canreuse the methods and data of the existing class ❏ You can extend the existing class by adding new data and new methods ❏ You can modify the existing class by overloading its methods with your own implementations Advantages Of Inheritance
  • 6.
    https://htree.plus/ Abstraction ❏ Objects inan OOP language provide an abstraction that hides the internal implementation details. ❏ Abstraction refers to the concept of hiding the complexities of a system from the users of that system
  • 7.
    Abstraction (Real World Example) ●For example, the coffee machine in your kitchen, you just need to know which methods of the object are available to call and which input parameters are needed to trigger a specific operation. But you don’t need to understand how this method is implemented and which kinds of actions it has to perform to create the expected result.
  • 8.
    Abstraction (By Programming) using namespacestd; class implementAbstraction { private: int a, b; public: // method to set values of // private members void set(int x, int y) { a = x; b = y; } void display() { cout<<"a = " <<a << endl; cout<<"b = " << b << endl; } }; int main() { implementAbstraction obj; obj.set(10, 20); obj.display(); return 0; }
  • 9.
    https://htree.plus/ Encapsulation ❏ Encapsulation isa process of combining data members and functions in a single unit called class.
  • 10.
    https://htree.plus/ Encapsulation (Example) ❏ using System; ❏namespace OPPs { ❏ class Encapsulation { ❏ private string Name = "Alex"; ❏ public string EmployeeName { // Property ❏ get { ❏ return Name; ❏ } ❏ set { ❏ Name = value; ❏ } ❏ } ❏ static void Main(string[] args) { ❏ string Name2 = string.Empty; ❏ // use properties ❏ Encapsulation e = new Encapsulation(); ❏ Name2 = e.EmployeeName; ❏ Console.WriteLine("Employee Name: " + Name2); ❏ Console.ReadLine(); ❏ } ❏ } ❏ }
  • 11.
    https://htree.plus/ Advantages Of Encapsulation &Abstraction ❏ Encapsulation helps us in binding the data(instance variables) and the member functions(that work on the instance variables) of a class. ❏ Abstraction helps the user to avoid writing the low level code ❏ Abstraction avoids code duplication and increases reusability. ❏ Abstraction can change internal implementation of class independently without affecting the user.
  • 12.
    https://htree.plus/ Polymorphism (By Real WorldExample) ● The word ‘polymorphism’ literally means ‘a state of having many shapes’ or ‘the capacity to take on different forms’.
  • 13.
    https://htree.plus/ Polymorphism (By Programming) ❏ Twotypes of polymorphism : - Dynamic Polymorphism - Static Polymorphism ❏ The process of binding the overloaded method within object at compile time is known as Static polymorphism ❏ In dynamic polymorphism method of the program binds with an object at runtime
  • 14.
  • 15.
    https://htree.plus/ Advantages Of Polymorphism ❏It helps programmers reuse the code and classes once written, tested and implemented. They can be reused in many ways. ❏ Single variable name can be used to store variables of multiple data types(Float, double, Long, Int etc). ❏ Polymorphism helps in reducing the coupling between different functionalities.
  • 16.
    References ❏ https://medium.com/omarelgabrys-blog/the-story-of-object-oriented-programming- 12d1901a1825 ❏ https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html ❏http://cs.smu.ca/~porter/csc/465/notes/oop.html ❏ https://atomicobject.com/resources/oo-programming/oo-quality ❏ https://medium.com/from-the-scratch/oop-everything-you-need-to-know-about-object- oriented-programming-aee3c18e281b ❏ https://www.javatpoint.com/java-oops-concepts ❏ https://tomassetti.me/oops-concepts/ ❏ http://www.differencebetween.net/technology/difference-between-oop-and-pop/ ❏ https://en.wikipedia.org/wiki/Object-oriented_programming ❏ https://en.wikipedia.org/wiki/Access_modifiers https://htree.plus/
  • 17.