Avatar of Rohit Bajaj
Rohit BajajFlag for India

asked on 

what is Liskov's Substitution Principle

Hi,
Please explain me the Liskov's Substitution Principle. Whats the use and why its important to follow this principle.

Thanks
Java

Avatar of undefined
Last Comment
Rohit Bajaj
ASKER CERTIFIED SOLUTION
Avatar of Tej Pratap Shukla ~Dexter
Tej Pratap Shukla ~Dexter
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Rohit Bajaj
Rohit Bajaj
Flag of India image

ASKER

I didnot understand this example clearly.
why will someone implement a function like :
private static Rectangle getNewRectangle()
      {
             
            return new Square();
      }

when we want a rectangle. this looks like a coding error
Java
Java

Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

102K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo