Java for Beginners 17 - Inheritance

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

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

  • @hippiestafarii
    @hippiestafarii 4 года назад +1

    Many thanks Marcus :-)

  • @MarcusBiel
    @MarcusBiel  9 лет назад

    In this episode I’m going to talk about Inheritance in Java. Inheritance is actually a very powerful feature of object-oriented languages. Similar to Interfaces, Inheritance allows to handle a group of similar objects in a uniform way. On top of that, however, it also allows to prevent code duplication by inheriting the members of a class from a parent class to its child classes. The members of a class, in case you don’t remember, are the instance variables and the instance methods, so everything that is not static. Okay. Well I guess this sounds very promising, the problem is, I think, inheritance is just a bit too powerful actually. If used incorrectly, Inheritance can severely damage your code so really take care and use Inheritance sparsely. There are definitely justified cases to use Inheritance but whenever in doubt I would not use it...