Open and Close Principle: It defines that our design or code should be open for extension but close for modification. In other word, open for extension means: when we create new base class then we need to design this base class such as way that it can be extended easily by just adding new derive class. Close for modification means: we should not disturb the existing code for any new feature. If we are changing in existing class then our design is not good.
If we can support new feature just adding new derive class and we are not touching existing class then our design is following (OCP).
source code with example: