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
madhumadhu 

when we will use virtual method and non-virtual in salesforce????

when we will use virtual method and non-virtual in salesforce????
bob_buzzardbob_buzzard
Virtual methods are used when the author expects an extension class to override the behaviour in certain circumstances. For example, a superclass that saves an account may define a virtual preSave() method to set up some related information prior to save.  A subclass that extends the superclass may have different related information requirements, in which case the preSave() method would be overridden and replaced with a method that carries out processing specific to the subclass.  This allows the subclass to take advantage of most of the functionality that the superclass provides, while replacing functionality as required for its specific requirements.