Suppose you know how to create plain Dohsa ( Dohsa class) , and you wanted to add flavor to it. You are thinking to prepare MasalaDohsa and OnionDohsa from this plain Dohsa.
So instead of modifying the main Dohsa class, you can add OnionDohsa and MasalaDohsa class which will extend dohsaDecorator class and add the flavor on the main plain Dohsa.
Continue reading “Decorator Design Pattern”
