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
pathi bahubhalipathi bahubhali 

Can any one ?

how will a standard / custom controller recognize the extension?
Abhishek_DEOAbhishek_DEO
In case of extension, we pass the reference of Standard/custom controller in constructor. Using that we can tell extension class belogs to which  standard/custom class.

As per doc: A controller extension is any Apex class containing a constructor that takes a single argument of typeApexPages.StandardController or CustomControllerName, where CustomControllerName is the name of a custom controller you want to extend.
 
ManojjenaManojjena
Hi Pathi,
Standrad controller is  a  system defind class which has nine  methods in that class .Basically in apex page component you have one attribute named standard controller where you need to assign either a standard object or a custom object.
When ever you will create an object in salesforce autatically salesforce will creaate a class for that object to interact with the standard Ui of that object .So finally salesforce have one class each for most of the object.
To know detail about the standard controller class you can click on the link belwo .

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/apex_ApexPages_StandardController_methods.htm
Once you will add standard controller you can not add controller which is your custom class  Why because you can have only one controller to a page .
So either your class will be a controller or you can use standard controller .If you want to add more then one class to a singel page then you need to
add extension to that .Means after one controller either standard/custom you can add extension .When ever you add second class to the page system will
ask you to create a default one argument constructor to the next class . If you have standard controller you need to pass ApexPage.StandardController  
instance else your custom class instance .
Check below link to know more detail about custom controller and extension .
If you have standard controller you need to add in your extension one argument constuctor like belwo
YourClassName(ApexPages.StandardController ctrl)
If you are using custom controller then you need to add constructor like belwo .
YourClassName(ControllerName instance)

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_def.htm

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_considerations.htm


Let me know if it helps you !!
Thanks
Manoj