#50-SOLID -Liskov Substitution Principle

Liskov Substitution Principle: SubType (Child Class)Must be Substitutable For Base Type(Base Class).

LSP comes into use when you use inheritance/Abstraction.


1.Child Class Should not remove Base Class Behaviour.

2.Child Class Should not violate base class invariants.

In short,the Calling code should not know whether it is calling the base class or derived class.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s