What are Virtual Methods?

前端 未结 14 525
傲寒
傲寒 2020-11-29 03:02

Why would you declare a method as \"virtual\".

What is the benefit in using virtual?

相关标签:
14条回答
  • 2020-11-29 03:52

    This link will provide you a better understanding with very easy example https://stackoverflow.com/a/2392656/3373865

    0 讨论(0)
  • 2020-11-29 03:59

    Virtual methods are similar to abstract methods in base classes except their implementation on derived classes is optional. Also you could put logic in virtual method and override these in derived classes.

    0 讨论(0)
提交回复
热议问题