Showing posts with label Abstraction. Show all posts
Showing posts with label Abstraction. Show all posts

Sunday, 25 March 2018

OOPs Concepts

Although its actually OOP concepts, but the most widely used term is OOPs Concepts. Though OOP stands for Object Oriented Programming, but what what does "s" stands for? System. "s" in OOPs stands for Object Oriented Programming System.

Lets talk about OOP concepts, the basics of all Programming Languages available today.
  • Abstraction
  • Encapsulation
  • Polymorphism
  • Inheritence

Abstraction
Abstraction is the concept of hiding the internal processing from outside world. We can implement abstraction using encapsulation and inheritance.

Encapsulation
Encapsulation is a means to achieve Abstraction. it is used to restrict the scope and usage of class members and methods. Access modifiers such as public, private and protected are used to restrict access.

Polymorphism
Polymorphism is a concept in which an object can behave differently based on different situations.
Polymorphism can further be classified into 2 categories, i.e. Run time Polymorphism, and Compile time polymorphism.

Inheritance
Inheritance is a means to achieve code reusability. It allows the properties of another class to be used in another class in a Parent-Child model. The class using the properties of another class is called the Derived class and the class whose properties are used by another class are called Base Class or Parent Class. Inheritance in Java is achieved using keyword "extends".
Types of Inheritance(in Java): Single Inheritance, Multilevel Inheritance, and Hybrid Inheritance