What are Virtual Methods?

前端 未结 14 582
傲寒
傲寒 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:40

    A short question, a short answer! Qualify your method as "virtual" if you think you will inherit of the class it belongs to.

    A longer answer: "virtual enables you to override, to give another meaning of your method in a derived class.

提交回复
热议问题