This blog shows how do you keep property as part of the interface, how do you implement that property on your class. Here, we specified that implementer of this interface, should implement the property DiscountPrice. Also, note that we asked for retrieval of the property value only needs to be implemented. So the Interface forces to Implement the DiscountPrice Property. Also it forces that it should be read only.
Consider the inteface below:
{
float DiscountPrice {get;}
}
Below is the class that implements the above interface property:
{
private int Price = 8000;
//Implementing the property
public float DiscountPrice
{
get { return price * 0.95f; }
}
}
interface IBus
public class SchoolBus:IBus

Join the conversation! Your thoughts help the community grow.