Liskov Substitution Principle in Object Oriented Design | SOLID Principles

Поделиться
HTML-код
  • Опубликовано: 23 дек 2024

Комментарии • 13

  • @SaiPrakash16
    @SaiPrakash16 Год назад

    Very well explained.

  • @kapilgoyal7808
    @kapilgoyal7808 2 года назад

    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.

  • @BAPPI_SWE
    @BAPPI_SWE 11 месяцев назад

    very good teaching approach🪅♥