+ 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.)
1 Odpowiedź
+ 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