OOP {

  O : Object,

      O : Oriented,

               P  : Programming

}

Why OOP ???

​Modularity

Code Reuse

Maintainability

Readability

Class & Object

A class is a blueprint for creating objects

An objects is refer to instance by which we can access all the property and methods of CLASS.

OOP Concepts

Encapsulation

Abstruction

Polymorphisom

Inheritance

Encapsulation

Abstruction

Hides the complexity and present essential features without including the background implementation

Several ways to achieve abstraction in OOP

  • Interface
  • Abstract class

Encapsulation

Encapsulation

Combines properties and method in same object

Encapsulation

Inheritance

Allows code re-use by creating parent and child relationship.

Share a set of attribute and method between parent and child class

Encapsulation

Polymorphism

The ability to appear in many forms

Two types :

  • Overloading - Compile time
  • Overriding - Runtime

Adds dynamic nature and flexibility in code

Encapsulation

Access Modifier

Encapsulation

Interface

An interface defines a public API, nothing is private about it. It's like a contract

A class to implement an interface called can-do (or -able ).

Interface enforce certain properties on an object (class)

Encapsulation

Interface VS Abstract Class

An interface is pure form of abstraction

 

An abstract class is a compromise between Abstraction and Concrete implementation.

Example :
- Interface: Barkable, Runable, Flyable, Swimable.
- Abstract Animal class and the sub class: Bolt, angrybird and Nemo.
- Abstract class and the sub class Machine: McQueen, Siddeley.

Encapsulation

Interface VS Abstract Class cont.

References

All Images are taken from online

You can checkout this blog

Plenty of resources out there, so feel free to search and give away of your confusion about any topics

Encapsulation

Anyone Have Any

Encapsulation

      ME {

name     : Emran Ul Hadi,

  find-me : emran.github.io

                       photo    : 

 

 

 

 

       }

Made with Slides.com