Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 28
    Because they are optional? Commented Feb 7, 2011 at 15:02
  • 2
    But you can cast the object instance to MyInterface and call it with the optional parameter: ((MyInterface)obj).TestMethod();. Commented Feb 7, 2011 at 15:06
  • 17
    @oded - but if you say this parameter is optional on the contract, why do you allow the implementer to not make it optional? doesn't that just cause confusion to anyone looking to use the contract? Commented Feb 7, 2011 at 15:07
  • 2
    I think in this case you can say that the parameter is optional in implementing, not in calling the implementing methods.When you call the method in the class you have to follow the class rules (the parameter is not optional in the class so you can't call the method without it), and in the second hand when you implement the interface you have to follow the interface rules,so you can override the methods with/without optional parameters. Just an opinion. Commented Feb 7, 2011 at 15:18
  • 2
    More detail problem explanation here -> geekswithblogs.net/BlackRabbitCoder/archive/2010/06/17/… Commented Feb 7, 2011 at 15:47