Skip to content

Shalini-lodhi/Open_Close_Principle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open-Closed Principle in Design Pattern in C#

The Open-Closed Principle (OCP) is a principle in object-oriented programming that states that software entities (classes, modules, functions, etc.) should be open for extension but closed for modification.

This means that you should be able to extend the behavior of a module or class without modifying its existing code. Instead of modifying existing code, you should be able to add new functionality by creating new classes, interfaces, or functions that work with the existing code.

The idea behind the OCP is to create code that is more flexible, maintainable, and reusable. By following this principle, you can avoid making changes to code that is already working and instead focus on adding new features or functionality.

In practice, this can be achieved by using techniques such as inheritance, composition, and interfaces. By designing your code with these techniques in mind, you can create modules and classes that can be extended without modifying their existing code.

Releases

No releases published

Packages

 
 
 

Languages