2 Replies - 520 Views - Last Post: 01 October 2012 - 07:37 AM Rate Topic: -----

#1 HopelessDev  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 136
  • Joined: 10-August 12

Interface methods

Posted 29 September 2012 - 09:43 PM

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?
Is This A Good Question/Topic? 0
  • +

Replies To: Interface methods

#2 HopelessDev  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 136
  • Joined: 10-August 12

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?
Was This Post Helpful? 0
  • +
  • -

#3 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4577
  • View blog
  • Posts: 8,019
  • Joined: 08-June 10

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1