14
I have Interface written in C# and is it already implemented by classes. Is it possible can i add one more property as optional in interface and without modifying the exiting implemented classes?
E.g
public interface IShape
{
int area { get; }
}
public class FindWindow : IShape
{
public int area
{
get
{
return 10;
}
}
}
In this FindWindow is already written. Is it possible can i add one Optional Property and not implementing in the existing class.
ie,
public interface IShape
{
int area { get; }
//optional
//string WindowName{get;}
}
public class FindWindow : IShape
{
public int area
{
get
{
return 10;
}
}
//WindowName i am not implementing here
}
public class FindWindowName : IShape
{
public int area
{
get { return 20; }
}
public string WindowName
{
get { return "Stack Overflow"; }
}
}