In your IShape code example, it isn't clear for me what is desirable to meet Interface Segregation Principle (ISP). Should IShape only have getArea () method only not to force Circle to have getWidth() method?
Yes. If IShape has the only getArea() method, it can be used in any shape i.e. Rectangle, Circle, Triangle to the area of that shape. The circle doesn't have width or height so Circle class itself can have a method called getRadius(). Similarly Rectangle can have getWidth() and getHeight().
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In your IShape code example, it isn't clear for me what is desirable to meet Interface Segregation Principle (ISP). Should IShape only have getArea () method only not to force Circle to have getWidth() method?
Yes. If IShape has the only getArea() method, it can be used in any shape i.e. Rectangle, Circle, Triangle to the area of that shape. The circle doesn't have width or height so Circle class itself can have a method called getRadius(). Similarly Rectangle can have getWidth() and getHeight().