When I googled to find the related topics about interface, I found this from MSDN website:
For example, an interface might declare a property that has a get accessor. The class that implements the interface can declare the same property with both a get and set accessor.
from MSDN
Now I have a doubt. When we specifically mentioned that the property should be read only(only ‘get’ accessor in the interface) why is it allowed to implement ‘set’ accessor also?
There’s a difference – when you use an interface, you’re not “specifying that the property should be read only”, but rather specifying that the contract defines a “readable property” of that specific name and type. Basically, the interface defines the minimum requirements for a contract, not the absolute requirements.
If you cast the object to the specific interface, the property setter will not be available. It’s really no different than having extra properties or methods on the object that aren’t available via the interface.