Object Oriented Programming

Object oriented programming is idea invented to write code that organized around object, which mean that we can create methods and attributes in the classes then created objects which adhere class ( class or interface ).

Object oriented concepts

  • Encapsulation
  • Abstraction
  • Polymorphism
  • Inhertiance

Encapsulation

Encapsulation is a main concept in object oriented, and it mean that class details is hidden inside, and we can access the attributes using getter and setter, so the attirbutes should be private.

Abstraction

Abstraction is like the details ( logic ) hidden inside the class itself, and the client shouldn’t know anything about it. Example for that when we light on a room, we don’t have to know anything about how the room light turned on but we only should concern about the pressing the lighting button.

Polymorphism

Is states that the classes should have different functionality with the same interface that adhere.

Inheritance

Is the concept that when a class of objects is defined, any subclass that is defined can inherit the definitions of one or more general classes.