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
abivenkatabivenkat 

Doubt in Basic

 

hi all,

 

What is Virtual? Why we are using Virtual keyword in a class? what it will do? 

Un which cases Virtual keyword is used ? i need some business or normal examples to understand this Virtual concept... please help me.. 

 

 

Thanks,

abivenkat,

SFDC Learner

Navatar_DbSupNavatar_DbSup

Hi,

This keyword is used when we want to override the behaviour of class

 

for more detail follow the below link

 

http://www.tgerm.com/2010/02/apex-virtual-abstract-inheritance.html

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 

JitendraJitendra

Hi,

Virtual means the ability of the function to be overriden by its child class.


If you want to create same function in child class without writing keyword "Virtual" then it will give you the compiler error as "It may be possible that you are creating the same function accidently in child class".

 

If you know very well and want to override the method intentionally then the keyword Virtual is used with the base class method.

 

 

abivenkatabivenkat

 

hi,

 

thanks for the definitions and explanations about the virtual base class.

I need any working example for this virtual class with extends and all stuff and need to know how we call and inherit all these in our main class or function, where i can work out here in my apex class and understand easily and clearly??? 

 

 

thanks,

abivenkat.

SFDC Learner