"when a client depends upon a class that contains interfaces that the client does not use, but other clients do use, then that client will be affected by the changes that those other clients force upon the class"
If we take an example,
public
class
Rectangle
{
public
int
Width {
get
;
set
;}
public
int
Height {
get
;
set
;}
}
Here the Rectangle class has two properties. If the client uses the Rectangle class directly, if there is another class which says Square, then those adjustments will not be available to that customer.
Rather there is a requirement of an interface, which the client use.
public
interface
IShape
{
public
int
Width {
get
;
set
;}
public
int
Height {
get
;
set
;}
}
public
class
Rectangle : IShape
{
public
int
Width {
get
;
set
;}
public
int
Height {
get
;
set
;}
}
public
class
Square : IShape
{
public
int
Width {
get
;
set
;}
public
int
Height {
get
;
set
;}
}
Thus if the client uses IShape instead of Rectangle, they will automatically get the functionality defined in Square or any other class that derives the IShape.