Apex and Basic Object Oriented Programming Concepts

by - 6:09 PM

After receiving bunch of comments on performing simple object oriented operation using Apex. I felt most of the learner need a quick guide of how to perform basic OOPS operation using Apex.

Based on request, I designed quick snipplets to help new user understand how to perform OOPS operation in Apex

Constructs of Apex

Encapsulation : 

When a class is defined it becomes a new data type in Apex

Properties in Apex :

Properties are the shortened form of a method thats has access to static and instance variable.

Apex supports Interfaces : Interface as skeletal class definitions containing list of methods with no implementations

PolyMorphism and Inheritance: Apex supports single inheritance, it allows to extend one other class and implement many interfaces. Interface can also extend multiple interfaces 

 Over-riding a methods is two step process
  • Parent class must provide virtual and abstract keyword on the methods to be over-ridden
  • In subclass, the override keyword is used on virtual and abstract methods to replace parent

Gradually, I'll add up some more snipplets of the basic concepts, I believe this would be helpful to many new comers of Salesforce kingdom

You May Also Like