OOPS ( Object Oriented Programming ) in Salesforce

 OOPS ( Object Oriented Programming ) in Salesforce



  • Class: 
    • Class is a blueprint or a template from which we can create objects of a class.
    • The class contains characteristics and behaviors where characteristics are variable and behaviors are called method.
Class Fruits{
    String color;
    String taste;
}
  • Object : 
    • Any real-world entity which has a state and behavior is called an object.
    • Eg: Book , Chair, Vehicle
            Fruits fruits = new Fruits();
    
  • Inheritance:-
    • A class that acquires all the properties and features of the parent class is called inheritance.
    • Inheritance is also used to achieve runtime polymorphism.
    • extends keyword is used to acquire the properties.
    • Eg: The child inherits the properties of the parent.
  
class parent {
    public void m1(){
       System.debug("parent method") ;
    }
}
class Child extends parent{
    
       Child child = new Child();
       child.m1();
   
}
  • Abstraction : 
    • It is the process of hiding implementation detail and showing only the functionality to the user.
    • IN other words, hiding internal details and only showing the required things.
    • Example: ATM machine, we don't know about the internal processing how the withdrawal will take place.
    
  • Polymorphism
  • Encapsulaion

Post a Comment

0 Comments