+ Start a Discussion
divakar ddddivakar ddd 

What is Transient and virtual key word ?

Surya Prakash TomarSurya Prakash Tomar
Hi Divakar,

Transient keyword-
Declares instance variables that cannot be saved, and should not be transmitted as part of the view state,  in Visualforce controllers and extensions. 

Virtual keyword-
Defines a class or method that allows extension and overrides. You can’t override a method with the override keyword unless the class or method has been defined as virtual.
Rahul KumarRahul Kumar (Salesforce Developers) 
Hi Divakar,
  • Use the transient keyword to declare instance variables that can't be saved, and shouldn't be transmitted as part of the view state for a Visualforce page. For example:
Transient Integer currentTotal;
Please refer the below link for reference. hope it helps.

Please mark it as best answer if the information is informative.so that question is removed from an unanswered question and appear as a proper solution.

Thanks
Rahul Kumar