Object Oriented Programming (OOP)

  • Inheritance , namely the inheritance of attributes and methods from the parent class to the child class.
  • Encapsulation , which is hiding information and implementation details of a method, as well as regulating access to attributes/methods (method access rights, usually using modifiers).
  • Polymorphism , which is making an object from a base class behave like another object that is its descendant. Polymorphism can also be said to have many forms implemented in multiple constructor classes.
  • Abstraction , namely defining abstract objects that are able to perform activities, change state, and communicate with other objects in the system, or in other words creating a class consisting of attributes and methods.

Encapsulation is necessary if your class is designed to perform a specific task, specifically producing consistent output (specific purpose).

Motto

I always make some of my variables private, if you want to see the contents, please ask the methods that I have given the mandate to.

Accessories

A function to get the value of a field / attribute / properties / variable. This kind of function usually throws a return in the form of a primitive value or can also be an object value. In addition, the properties / attributes are declared as private. And no less important is about the naming convention, methods designed as accessors usually begin with get.


Post a Comment

Previous Next

نموذج الاتصال