Liskov Substitution Principle in Object Oriented Design | SOLID Principles

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ก.ค. 2024
  • In this video we will cover Liskov Substitution Principle of object oriented design.
    It is one of the SOLID principles.
    This principle states that objects of super class should be substitutable with the objects of the sub class.
    OR
    The properties and behavior of sub-class inherited from the super-class are substitutable with the properties and behavior of super-class.
    You will understand important concepts of Object oriented programming such as encapsulation and inheritance and commonly asked interview questions.
    🔗Website:
    Full Course: www.thinkxacademy.com/Object%...
    🔗Download Android App(Notes+Videos): play.google.com/store/apps/de...
    🌐Join our community:
    Facebook: / thinkxacademy
    Twitter: / thinkxacademy
    Instagram: / thinkxacademy

ความคิดเห็น • 13

  • @SaiPrakash16
    @SaiPrakash16 ปีที่แล้ว

    Very well explained.

  • @BAPPI_SWE
    @BAPPI_SWE 6 หลายเดือนก่อน

    very good teaching approach🪅♥

  • @kapilgoyal7808
    @kapilgoyal7808 ปีที่แล้ว

    Good Explanation with Visual

  • @tejaswigutta9017
    @tejaswigutta9017 2 ปีที่แล้ว

    Can you also please explain how will you solve the shape,circle,square and rectangle problem ¿
    Great and clear explanation @ThinkX Academy

    • @ThinkXAcademy
      @ThinkXAcademy  2 ปีที่แล้ว +1

      The answer to this lies in next video of this course i.e. Interface Segregation (hint: Encapsulate what varies)

    • @tejaswigutta9017
      @tejaswigutta9017 2 ปีที่แล้ว

      @@ThinkXAcademy is this how we do it¿
      interface Shape{
      void area();
      }
      Class Rectangle implements Shape{
      int length;
      int breadth;
      Rectangle(int l,int b){
      length =l,
      breadth=b;
      }
      @override
      void area(){
      System.out.println(length*breadth);
      }
      }
      Class Square implements Shape{
      int area;
      Square(int a){
      area=a;
      }
      @override
      void area(){
      System.out.println(area*area);
      }
      }

    • @ThinkXAcademy
      @ThinkXAcademy  2 ปีที่แล้ว +1

      Correct now area() is not coupled with shape class and every subclass has its own implementation. This concept is loose coupling.

    • @tejaswigutta9017
      @tejaswigutta9017 2 ปีที่แล้ว

      @@ThinkXAcademy Shape is an interface in my code and not a class.
      As per my understanding the two classes rectangle and square are loosely coupled and shape is an interface.
      Please correct me if I'm wrong

    • @ThinkXAcademy
      @ThinkXAcademy  2 ปีที่แล้ว

      You can make shape a class then only inheritance is possible and create an interface calculateArea.