How does the given code violate the Open/Closed Principle (O…
How does the given code violate the Open/Closed Principle (OCP)? public class SecurityPolicyFactory { public static SecurityPolicy getSecurityPolicy(String trustLevel) { switch (trustLevel) { case “High”: return new HighSecurityPolicy(); case “Medium”: return new MediumSecurityPolicy(); case “Low”: return new LowSecurityPolicy(); default: throw new IllegalArgumentException(“Unknown trust level: ” + trustLevel); } }
Read Details