|
|
| | |
| Yes, current solution is violating OCP which says we should be able to extend the functionality by adding new code and not by modifying the existing code. | |
| | |
|
|
|
|
|
|
| | |
| What if next problem statement is that the Switch should also be able to control other similar objects like Fan. For that Switch class needs to be modified. | |
| | |
|
|
| | |
| Oh ! why I did not think about that ??? | |
| | |
|
|
|
|
|
| | |
| So Now Our new UML Diagram should take care of that. | |
| | |
|
|
|
|