function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chaitanya nandamuri 2chaitanya nandamuri 2 

Am new to salesforce Trying to Understand extension_controller's constructor

//This is an extension controller class
public class Speaker_conf_extension {

     private final Speaker__c speaker; // speaker__c is custom object and standard controller which is using This(Speaker_conf_extension)                                                                           //extension class
     
      private ApexPages.StandardController sController;
    
    public Speaker_conf_extension(ApexPages.StandardController scontroller) {
    
    this.speaker= (speaker__C)scontroller.getRecord();
    this.scontroller = scontroller;
    
    }

public PageReference save() {
..................................
...............................
...............
return null;
}

This extension_controller is trying to over ride Save button and insert an InputFile field to upload image.
I didn't understand what the  constructor of extension_controller is doing . Please explain the behaviour ,Thank you 
PINKY REGHUPINKY REGHU
Hi,
A controller extension is any Apex class containing a constructor that takes a single argument of type ApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend.
For controller extension ,a constructor is used to pass a single record or multiple records to the class. 
Please let me know if that helps you.
If it helps don't forget to mark this as a best answer!!!
MUHAMMED SEMIN P NMUHAMMED SEMIN P N
Hi Chaitanya,
A controller extension is an Apex class that extends the functionality of a standard or custom controller. Use controller extensions when:You want to leverage the built-in functionality of a standard controller but override one or more actions, such as edit, view, save, or delete.
You want to add new actions.
You want to build a Visualforce page that respects user permissions. Although a controller extension class executes in system mode, if a controller extension extends a standard controller, the logic from the standard controller does not execute in system mode. Instead, it executes in user mode, in which permissions, field-level security, and sharing rules of the current user apply.

please refer below links these will give an overview of controller extension!!!
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extension.htm
 

hope this will help you, if it solve your problem please mark it as a 'best answer'
thank you,