Menu

 Does This Code Violate The OCP Principle? Why?If It Is Violated, Rewrite The Code In A Way To Comply With The OCP Principle.

 Does This Code Violate The OCP Principle? Why?If It Is Violated, Rewrite The Code In A Way To Comply With The OCP Principle.

Does this code violate the OCP principle? Why?
If it is violated, rewrite the code in a way to comply with the OCP Principle.

student submitted image, transcription available below

 

Expert Answer

Step 1
  1. Yes, this code violates the OCP principle. The OCP principle stands for Open-Closed Principle, which…

OR