GoingNative 2013 Inheritance Is The Base Class of Evil

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

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

  • @ashrasmun1
    @ashrasmun1 6 лет назад +6

    20:30 No wonder he has no "copy" in the output if he removed it from the code :D

  • @allopeth
    @allopeth 6 лет назад +3

    Isn't that "polymorphic type" precisely just a variant?

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

      kindly answer this someone ^

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

      It's effectively a variant which embodies a self-contained polymorphic draw function.

    • @adamnevraumont4027
      @adamnevraumont4027 2 года назад +8

      A variant is one of a closed set of types. This is one of an open set of types that support a particular operation.

    • @boogly3716
      @boogly3716 Год назад +5

      ​@@adamnevraumont4027 For anyone as dumb as me, i translate their comment into even more easy one:
      std::variant has to know all the types it will contain, because we provide them in std::variant's declaration. This is a closed set.
      Type erasure (technique shown in vid) doesn't have to know all its types. It has to know some common operations they can perform.
      The first restricts types, but doesn't - operations
      The second restricts operations, but doesn't - types

    • @badnoodlez
      @badnoodlez 8 месяцев назад

      this is effectively a constrained std::any -- I previously implemented Any using this form of type erasure.