As I understand it, all member functions are virtual in D but the compiler is free to make functions non-virtual if it sees that they are never overridden.
What I'm not clear on is what happens when you compile a module in which member functions are not overridden and then import that module somewhere else where you override a member function. I don't think it re-compiles the original module. Does it simply assume that any member function with external linkage is virtual?
All D member functions are virtual by default. I don't think there's any compilers out there that actually make functions non-virtual as an optimization. You can do it manually though, by marking the class or the function as "final".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With