Salesforce Apex Development - Object Oriented Programming (OOP) in Apex

 



Hi Everyone,
I have started the blog series for Salesforce Apex development, so if you want to learn more then follow my blog post.
In this post, I will talk about the OOPs concept, not in detail but only concepts

OOP(Object Oriented Programming)


OOP(Object Oriented Programming) is a methodology that provides a way of modularizing a program by creating a partitioned memory area for both data and methods that can be used as a template for creating copies of such modules (objects) on demand.

Unlike procedural programming, here in the OOP programming model, programs are organized around objects and data rather than action and logic.

This means Object-oriented programming (OOP) is a style of programming characterized by the identification of classes of objects closely linked with the methods (functions) with which they are associated.

The main OOP principle is:
  1. Encapsulation
  2. Inheritance
  3. Polymorphism

Encapsulation: the wrapping up of data and methods together is called encapsulation. 
For example, if we take a class we write the variables and methods inside the class. Thus, a class is binding them together. So a class is an example of encapsulation. It is also known as Data Hiding.

Inheritance: It creates new classes from existing classes so that the new classes will acquire all the features of the existing classes is called Inheritance.
A good example of Inheritance in nature is parents producing the children and children inheriting the qualities of parents.

Polymorphism: Polymorphism represents one form in multiple forms. In programming, we can use a single variable to refer to objects of different objects which means that a single variable you can refer to in the second object can be an extension of the first object. Thus using that variable we call the methods of different objects. A method call can perform different tasks depending on the type of object.

These are the Oops concept you need to consider you will start learning upcoming apex episodes


Connect/Follow for more information on Salesforce Apex.

Thanks!
Next Post Previous Post
No Comment
Add Comment
comment url