Virtual and override | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Virtual and override

so why not just simply code the method in the derived class and not on the base class ?

28th Mar 2017, 2:13 PM
Gero Manalili
Gero Manalili - avatar
2 Answers
+ 2
C isn't object oriented, it doesn't have polymorphism. If you meant C++ or C#, you need to declare polymorphic functions in the base. Then code that uses the base class can call polymorphic methods.
28th Mar 2017, 6:55 PM
Igor B
Igor B - avatar
0
i meant for the c# sorry for that confusing tag
29th Mar 2017, 7:07 AM
Gero Manalili
Gero Manalili - avatar