design-patterns-csharp
design-patterns-csharp copied to clipboard
Liskov substitution principle violation
Hi. First of all thanks for an amazing "refactoring.guru" resource. It's definitely a great contribution to global IT education. However, I think that this example violates the Liskov substitution principle since the Leaf class does not properly implement Add and Remove methods of the base Component class. As such you had to use IsComposite method and call it in the client code.
Here is my humble attempt to fix it https://github.com/RefactoringGuru/design-patterns-csharp/pull/6