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.
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:
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.
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.
- 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:
Please refer the below link for reference.- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_keywords_transient.htm
- https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_extending.htm
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