Showing posts with label OOP. Show all posts
Showing posts with label OOP. Show all posts

Object Oriented Programming(OOP)


  • It is one of an approach that come into existence in the 70’s for developing the applications in place of procedural programming approach.
  • OOP is most successful approach that was available in the industry used for building applications with the main feature like security and reusability.
  • A language to be called as object oriented needs to satisfy 4 important principal like
  1. Encapsulation: Hiding the data
  2. Abstraction:  Hiding the complexity
  3. Inheritance:  Reusability
  4. Polymorphism: Multiple behaviour based on input.

  1. Encapsulation : It is an approach of hiding the data by wrapping it under a container known as class which provides the basic security for its members.
  2. Abstraction : It is an approach of hiding the complexity of the member and providing with the set of interfaces to consume the functionality. Functions and methods one a good example for abstraction because in both these cases we call a function or a method without knowing the underlying logic.
  3. Inheritance : It is an approach of the children reusing the property of their parents. That provides reusability. We can implement the same in our language by establishing parent child relationship between the classes so that child classes can consume the member of it parent class.
  4. Polymorphism : It is an approach of behaving in different way depending upon the received input that is  wherever the input changes  automatically the output or behavior also change accordingly.

Developing application for different programming approach.

Developing application for different programming approach.

  1. Procedural Programming (Example:- C Language)
    • In this approach a program is a collection of member like variable and functions and all the member we define in the program are called for execution from the main function of the program.
    • The major disadvantage in this approach is lack of security and lack of re-usability.
  2. Object oriented programming language(OOP) (Example :- C++, Java ,C#)
    • The major strength any OOP language is Security and re usability
    • OOP also a program is a collection of member like variables and functions only, But to protect these member we enclose them under a Container or Wrapper know as a Class.

What is Class?

A class is a User defined data type very similar to structure we come across in procedural languages but the main difference between them is, Structure in procedural languages can contain only variable in it whereas a class in opp language can contain both variable and function also

In the above case Student and Employee are two new data types .Where the difference is Student come under the Structure and Employee Come Under the Class.