From 70f07fb34fb0f15f0a59b2d923539244c698fca4 Mon Sep 17 00:00:00 2001 From: Eduard Kaverinskyi Date: Sat, 8 Feb 2025 17:44:25 +0100 Subject: [PATCH] Update 17.SOLID.md Fix Open/Closed Principle examples --- 17.SOLID.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/17.SOLID.md b/17.SOLID.md index 34754d1..a212e55 100644 --- a/17.SOLID.md +++ b/17.SOLID.md @@ -126,7 +126,7 @@ This means that the behavior of a module/class/function can be extended without Let's consider an example of a `TaxCalculator` class that calculates tax based on the type of product. Initially, the class is not following `OCP`, because **_every time a new tax type is introduced, the class has to be modified._** -#### Correct Example +#### Incorrect Example ```python class TaxCalculator: @@ -138,7 +138,7 @@ class TaxCalculator: # More conditions for other product types ``` -#### Incorrect Example +#### Correct Example To follow the `OCP`, we can define a generic `TaxCalculator` class and then extend it for each specific tax type.