Design Principle - Liskov's Substitution Principle | Simple Programming

Опубликовано: 02 Ноябрь 2024
на канале: Simple Programming
2,315
21

Welcome to Simple Programming

Today, we are going to look at Liskov's Substitution Principle.

This principle explains how a derived class if used incorrectly can completely alter the program nature.

According to wikipedia, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program.

We must make sure that new derived classes are extending the base classes without changing their behavior.