I am wriiting a extension on Case object. There I want to write a save method with my own logic and want this save method should override the standard Save method.
So my code goes like below:
public class MyCaseControllerExt {
private final Case caseObj;
// get Case record from the standard controller and putting it in a member variable
public MyCaseControllerExt (ApexPages.StandardController stdController) {
this.caseObj = (Case)stdController.getRecord();
}
public override PageReference save(){
// TO DO
return null;
}
}
But, while saving the class, I am getting 1 error :
Save error: MyCaseControllerExt : Method does not override an ancestor method: System.PageReference save()
So my question is how we will override the existing Save method in extension class?