Why is it that interface methods are not declared as virtual and the implementing class does not use override when declaring the method from the interface? Is it just how the runtime handle interfaces?
Interface methods
Page 1 of 12 Replies - 237 Views - Last Post: 01 October 2012 - 07:37 AM
Replies To: Interface methods
#2
Re: Interface methods
Posted 30 September 2012 - 01:21 AM
Found the answer. interface methods are not virtual because you are not required to override virtual methods which is somewhat contradicting to the "contract" you get from implementing an interface. right?
#3
Re: Interface methods
Posted 01 October 2012 - 07:37 AM
That's a good way to look at it. Another is that virtual can only apply to real methods. Interfaces don't have methods, they're a contract. Therefore, it wouldn't make sense to have their methods as virtual.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|