GoingNative 2013 Inheritance Is The Base Class of Evil

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 มิ.ย. 2024

ความคิดเห็น • 7

  • @ashrasmun1
    @ashrasmun1 5 ปีที่แล้ว +6

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

  • @allopeth
    @allopeth 5 ปีที่แล้ว +3

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

    • @satyamtiwary5276
      @satyamtiwary5276 3 ปีที่แล้ว

      kindly answer this someone ^

    • @jasoncole7711
      @jasoncole7711 2 ปีที่แล้ว

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

    • @adamnevraumont4027
      @adamnevraumont4027 2 ปีที่แล้ว +6

      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 หลายเดือนก่อน +4

      ​@@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 24 วันที่ผ่านมา

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