Welcome to my blog

I have been working with Salesforce for quite a while, so don’t hesitate to contact me if you have any questions or want some advice.

s f

Subscribe
Follow Us
h

APEX ORIENTED OOPS (OBJECT ORIENTED PROGRAMMING)

 . Apex  . APEX ORIENTED OOPS (OBJECT ORIENTED PROGRAMMING)

APEX ORIENTED OOPS (OBJECT ORIENTED PROGRAMMING)

Apex Oriented OOPs (Object Oriented Programming) in Salesforce

Before going to do coding in apex once recall the basics of object oriented programming (OOP) language concepts.

What is OOPs :-

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

Unlike procedural language, here in oops programming language programs are organized around objects and data rather than action and logic.

The main OOPs Principles used in apex Language are,  

  • Object
  • Class
  • Inheritance 
  • Polymorphism    
  • Abstraction
  • Encapsulation

Object:-  

In this real word Any entity that has state and behavior is known as an object.  It can be physical and logical.  

Example: Book, Ball, Spoon, Van, water Bottle, etc.


Class :- 

Class is a Collection of objects. It is a logical entity.

Example: The animal is class and Animal types are objects. There are many objects in a class.

Inheritance :

When one object acquires all the properties and behavior of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

Example: Parents producing the children inheriting qualities of the parents.

Polymorphism:- 

When one task is performed by different ways simply it’s called as polymorphism. we use method overloading and method overriding to achieve polymorphism.

Example: We want to go from one place to another place in the vehicle but the vehicle type is different.

Abstraction:- 

Hiding internal details and showing functionality is known as abstraction. we use abstract class and interface to achieve abstraction.

Encapsulation:-

Binding (or wrapping) code and data together into a single unit is known as encapsulation.

Example: ATM machines, we don’t know the inside ATM.

Comments

  • Azalee Woodert

    July 1, 2022

    Aw, this was an extremely good post. Spending some time and actual effort to make a superb article… but what can I say… I procrastinate a whole lot and don’t seem to get nearly anything done.

    reply

Post a Comment