OOP's Concepts

Here I will explain the OOP's concept with the help of inheritance example.
  • 2731

Introduction

OOP is a design philosophy. It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal). OOP means Object Oriented Programming. This is a technique used to create programs around the real world entities. In OOPs programming model programs are developed around objects and data rather than actions and logics. Object-oriented programming (OOP) is a computer science term used to characterize a programming language that began development in the 1960's. The term object-oriented programming was originally coined by Xerox PARC to designate a computer application that describes the methodology of using objects as the foundation for computation. Object Oriented Programming Concepts Three of the most basic concepts for object oriented programming are Classes Objects and Methods. 

Properties of OOP: The some properties of OOPs is fallowing as:

  • Object: An object can be considered a "thing" that can perform a set of related activities
  • Class: A class is simply a representation of a type of object
  • Encapsulation: Encapsulation hides the inner workings of an object from outside users of the object.
  • Polymorphisms: Polymorphism allows one interface to be used for a set of actions i.e. one name may refer to different functionality.
  • Inheritance: Inheritance is a process of deriving the new class from already existing class.
  • Abstraction: Abstraction is a process of hiding the implementation details and displaying the essential features.

Advantages of OOP: some advantage of OOPs is

  • Provides flexibility in the modification of an existing application.
  • Promotes the reuse of code.
  • Enables the use of real-world modeling.
  • Helps with the maintenance of Code.

Example: Simple Example of OOP's.

Code:

class A{
 m1(){
 System.out.println("m1 method");
 }
}
class B extends A{
 m2(){
  System.out.println("m2 method");
 }
 public static void main(String args[]){
   B b = new B();
   System.out.println(b.m1);
   System.out.println(b.m2);
 }
}

OUTPUT:

m1 method
m2 method

Summary: This is the simple example of inheritance properties of OOP's.

© 2020 DotNetHeaven. All rights reserved.