What is the use of virtual function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is the use of virtual function?

advantage and uses of virtual function

20th Jul 2017, 2:56 PM
nandakumar
8 Answers
+ 14
C++?
20th Jul 2017, 3:12 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 7
Adding resources to code....
20th Jul 2017, 11:08 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
@nandakumar - name is too long - not typing it again Do you understand classes and functions well? If you do not, the answer will not help you.
20th Jul 2017, 3:22 PM
Manual
Manual - avatar
+ 5
In which language?
20th Jul 2017, 3:11 PM
Manual
Manual - avatar
+ 1
in c++
20th Jul 2017, 3:13 PM
nandakumar
+ 1
what is the use of virtual function in c++?
20th Jul 2017, 3:13 PM
nandakumar
0
At least in C#, it's used when you want to inherate a function with different implementation. For example, the superclass will have the virtual function, while the subclasses will have the same function but instead of "virtual" they will have "override". That way it's gonna be the same method with different implementation on every subclass
21st Jul 2017, 1:05 PM
Miguel Alejandro González Jiménez
Miguel Alejandro González Jiménez - avatar