OOPs Basic Concept :

Programming:

  • Programming is a way of giving instructions to computer about what they should do next.
  • These instructions are known as code & programmers write the code to solve the problems or perform a task.
  • So, we can control the machine by programming.
  • Trial & Error is possible in programming.

Paradigm:

  • Paradigm means Idea.
  • Some programming paradigm are mentioned below.
    • Procedure Oriented Programming
    • Functional Programming
    • Modular Programming
    • Object Oriented Programming

Multiparadigm:

  • Below languages are multiparadigm
    • Java – It supports OOPs & FP paradigm
    • Python – It supports OOPs, FP & POP paradigm
    • Javascript – It supports OOPs, FP & POP paradigm

OBJECT ORIENTED PROGRAMMING :

  • OOPs is a methodology or paradigm to design a program
  • It provides below concepts
    • Encapsulation
    • Inheritance
    • Abstraction
    • Polymorphism

Class:

  • It is a template or blueprint that describes the state & behavior of the object.
  • Collection of object is known as class.
  • It allocates memory for objects.

Objects:

  • Real world entity
  • It represents class / It is instance of a class
  • It is memory reference of a class
  • It is combination of states & behaviors

Example:

  • Vehicle – Class & Car, Jeep – Object
  • India – Class & Citizen – Object
  • Human – Class & Man & Women – Object
  • Fruit – Class & Apple, Mango, Banana – Object
  • Food – Class & Briyani, Sampar rice – Object

Method:

  • Set of instructions grouped together to perform a certain activity / task is known as method.
  • Activities (Methods) are done by objects & class.
  • Ex:
    • Watching TV is one task or activity.
    • Switch on & off the TV, Change the channel, Increase & Decrease the volume these are the set of instructions for watching TV.

Encapsulation:

  • It is the process of hiding the information details & protecting the data.
  • Ex:
    • Bank does not share our account details with others. Those account details are viewed by respective person.
    • Bank hides the information from external & keeping our data securely.
  • Access Modifiers in java, that specifies the accessibility or scope of a variable, method, constructor & class.
  • Access Modifiers do major role in data protection.

Inheritance:

  • It is the process of creating one class from an existing class.
  • It leads to the concept of re usability which means the features of the existing class (base class) can be used in the new class (derived class) without rewriting it.
  • Ex:
    • Child inherits the activities / properties from their parents.

Abstraction:

  • The process of showing only essential things & hiding the background details / inner details.
  • Ex:
    • We can handle TV, Washing machine, AC, Vehicles & ATM card yet we don’t have the knowledge of their inner operations.

Polymorphism:

  • Poly means Many & Morphism means faces / Different form.
  • One task performed in different ways is known as polymorphism.
  • Ex:
    • A person at the same time can have different characteristics.
    • He is a son, brother, husband, father, employee & friend.
    • Same person have different character in different situation.

Leave a comment

Design a site like this with WordPress.com
Get started