+ Start a Discussion
Chitral ChaddaChitral Chadda 

Triger framework

https://developer.salesforce.com/page/Trigger_Frameworks_and_Apex_Trigger_Best_Practices
IN THIS link
public class OpportunityTriggerHandler extends TriggerHandler {

  public OpportunityTriggerHandler() {}

  /* context overrides */

  protected void override beforeUpdate() {
    setLostOppsToZero();
  }

  protected void override afterInsert() {
    doSomeAfterInsertStuff();
  }

  protected void override beforeDelete() {
    doSomeStuffBeforeDelete();
  }

  /* private methods */

  ....

}


Here they have not defined triggerhandler class anywhere in the link provided
also, how is this done override , nothing specified :
 

/* context overrides */

  protected void override beforeUpdate() {
    setLostOppsToZero();
  }

  protected void override afterInsert() {
    doSomeAfterInsertStuff();
  }
 

 

SonamSonam (Salesforce Developers) 
https://github.com/kevinohara80/sfdc-trigger-framework/blob/master/src/classes/TriggerHandler.cls is the triggerhandler class code. This should help you understand the override part of the code now.
Chitral ChaddaChitral Chadda
i checked this , bt hardly i cud understnd anytthing at all . how overiding is done
SonamSonam (Salesforce Developers) 
Ok, if you read through the TriggerHandler.cls which is created here as a INTERFACE(http://www.tutorialspoint.com/java/java_interfaces.htm), you will find all the method signatures as below:
@TestVisible
protected virtual void beforeInsert(){}
@TestVisible
protected virtual void beforeUpdate(){}
@TestVisible
protected virtual void beforeDelete(){}
@TestVisible
protected virtual void afterInsert(){}
@TestVisible
protected virtual void afterUpdate(){}
@TestVisible
protected virtual void afterDelete(){}
@TestVisible
protected virtual void afterUndelete(){}

Now when the 
OpportunityTriggerHandler extends this Interface, it can now override the methods defined in the interface as it has done:


protected void override beforeUpdate() { setLostOppsToZero(); } protected void override afterInsert() { doSomeAfterInsertStuff(); } protected void override beforeDelete() { doSomeStuffBeforeDelete(); }

Hoping this helps..if you still find it unclear with the concept, kindly go through 
http://www.tutorialspoint.com/cplusplus/cpp_interfaces.htm
http://www.cs.utah.edu/~germain/PPS/Topics/interfaces.html