Learn Kotlin for Android: Interfaces (Lesson 20)

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

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

  • @ioanricean6949
    @ioanricean6949 3 года назад +3

    Nice explained!

  • @younghirsch
    @younghirsch Год назад +1

    I agree with @BunsenBurns, there is no consistency in your example, it's really bad honestly... Banana has sugar, fun hello(), fun writeSomething(), super confusing. Try to make it more structured next time mate...

  • @RoshitGopinath
    @RoshitGopinath 4 года назад

    What's the difference between an Abstract Class and an Interface?

    • @zolongOne
      @zolongOne 3 года назад +6

      Abstract class is a class that you don't want someone else to create an object from it while an interface class is a class that is used when there are functions or properties that you want to use in another class, but can't inherit from it for example; class Vehicle can't inherit from class Animal which has a method roar that you want to use with class Vehicle because a Vehicle cannot be an Animal, so an interface (let's call the interface Roarable) can be created with a method roar(), and the interface can now be inherited by class Vehicle in order to use/implement roar() method.

  • @BunsenBurns
    @BunsenBurns 3 года назад

    what strange choices of classes... why have apple implement banana? wouldn't it make far more sense to have defined a fruit superclass or interface?

    • @Indently
      @Indently  3 года назад

      There are probably a million better examples. But these are the ones I went with at the time, and if you got the basic concept, then that's all that matters :)