Extension is usually used from a reusbale code perspective. If i have some functionality in one class and i want to use it somewhere else also then instead of coding that part, you can add an extension to the controller and reuse the code used in extension class.
Standard controllers can provide all the functionality you need for a Visualforce page because they include the same logic that is used for a standard page. For example, if you use the standard Accounts controller, clicking a Save button in aVisualforce page results in the same behavior as clicking Save on a standard Account edit page.
public class myControllerExtension {
private final Account acct;
public myControllerExtension(ApexPages.StandardController stdController) {
this.acct = (Account)stdController.getRecord();
}
}
Extension is usually used from a reusbale code perspective. If i have some functionality in one class and i want to use it somewhere else also then instead of coding that part, you can add an extension to the controller and reuse the code used in extension class.
Thanks,
Pratik
to associate a page with the standard controller for a custom object named MyCustomObject, use the following markup Extension
Standard controllers can provide all the functionality you need for a Visualforce page because they include the same logic that is used for a standard page. For example, if you use the standard Accounts controller, clicking a Save button in aVisualforce page results in the same behavior as clicking Save on a standard Account edit page.
Page:- Class:-
https://developer.salesforce.com/page/Building_Visualforce_Pages_Using_the_Standard_Controller
https://www.salesforce.com/docs/developer/pages/Content/pages_controller_std_associate.htm
https://www.salesforce.com/docs/developer/pages/Content/pages_controller.htm