OCP - Open Closed Principle

"Classes should be open for extension but closed for modification."

This principle simply means that a class should not allow modification in its code due to a change in functionality. It should only allow you to extend the functionality in some form, for example, by inheritance.

Once again, this principle is satisfied in our decorator example, where our persistence decorator (derived) classes implement the abstract base class to extend (and add up) the functionality instead of modifying the existing class.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.186.109