Mastering Embedding (Composition) and Promotion in Go with Code Examples

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

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

  • @ashishm8850
    @ashishm8850 10 месяцев назад +2

    Excellent as always 👍

  • @IvanFedulov
    @IvanFedulov 2 месяца назад

    though still cannot comprehend why go allows to access promoted ommiting inner type name 2:32, while requires it in composite literal, when we creating such variable 2:17.

    • @codeandlearnwithlove
      @codeandlearnwithlove  2 месяца назад

      Could you please clarify your question? If you are talking about why internal fields are not promoted, it is because by doing so, it would break the whole concept of exported and internal only field as that would mean we are leaking out internal implementation via composition.

  • @somyaranjandas4599
    @somyaranjandas4599 5 месяцев назад

    what is the diffrence passing directly struct type and passing using & ? i tied it seems same result

    • @codeandlearnwithlove
      @codeandlearnwithlove  5 месяцев назад

      No difference. The Go compiler is smart enough to use the passed value as needed. If you pass a value when a pointer is required, it can derive the pointer from passed in value.

    • @somyaranjandas4599
      @somyaranjandas4599 5 месяцев назад

      @@codeandlearnwithlove Thanks for the clarification, i am new to golang ,can you make a series on dsa using golang ? it will be very helpful

    • @codeandlearnwithlove
      @codeandlearnwithlove  4 месяца назад

      @@somyaranjandas4599 I have plans for it, but first I want to complete the Go course.