Polymorphism | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Polymorphism

Can somebody explain what “virtual” and “override” does? I’m at the lesson, but it didn’t really explain well. (And, if possible, please state real world examples, or understandable ones.)

8th Nov 2019, 10:08 PM
Jake
1 Answer
+ 1
Polymorphism is the ability for code to behave different due to the way it was created. You can define a method as virtual. This allowes derived class to change the behaviour of that method. https://code.sololearn.com/c7P1Q7lSmIWU Hope this clearify's a bit. https://www.w3schools.com/cs/cs_polymorphism.asp https://www.tutlane.com/tutorial/csharp/csharp-polymorphism
8th Nov 2019, 10:40 PM
sneeze
sneeze - avatar