Question: e) Explain the open-closed principle. Also, look at the following class diagram, where the class Client calculates the area of a Rectangle. A new
e) Explain the open-closed principle. Also, look at the following class diagram, where the class Client calculates the area of a Rectangle. A new class Triangle should be added to the application. Apply the open-closed principle and modify the class diagram, for the Client to be able to work with both Rectangle and Triangle. Rectangle +area(): double Client +calculateArea(shape: Rectangle)
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
