Mastering OOP: Objects, Classes, Inheritance, Polymorphism, and more! | Geekific

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

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

  • @espresso-byte
    @espresso-byte 18 дней назад

    Good content! Kudos!

  • @unicorn1655
    @unicorn1655 23 дня назад

    Thanks for this video!
    Could you explain when a constructor is needed? If I write a class Test I can create an object by typing class Test test = new class.
    So when/why would I need a constructor?

    • @geekific
      @geekific  23 дня назад

      A constructor is a special method in a class that is used to initialize objects. While it’s true that you can create an object without explicitly defining a constructor (as many languages like Java provide a default constructor automatically), constructors become essential when you want to set initial values, encapsulate initialization logic, avoid repetitive code... let us know if this answers your question!