What is the difference in having a virtual keyword before function name and variable name? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference in having a virtual keyword before function name and variable name?

usage of virtual variables and virtual functions??

10th Jan 2017, 7:05 PM
Sai Krish
Sai Krish - avatar
1 Answer
+ 1
as far as I know virtual applies only for methods and not for variables. you should put them under protected if they should be accessible in the derived classes
10th Jan 2017, 9:30 PM
Gunther Strauss
Gunther Strauss - avatar