3 ms·
There are certain optimizations that I am able to perform by knowing if a function is virtual or not---this is especially important in the Trait implementation.
by mikegerwitz 13y ago
There are certain optimizations that I am able to perform by knowing if a function is virtual or not---this is especially important in the Trait implementation.
However, the original intent is based on compelling rationale from C#. I cannot find the original article where the article explains the rationale, but aside from optimization benefits and self-documenting code, he makes the point that virtual methods are essentially callbacks/hooks into existing code; you therefore need to put careful thought into how to handle those virtual methods properly and expose the proper APIs.