Viewing 2 reply threads
  • Author
    Posts
    • #9166
      Avatardiana
      Participant
        Up
        1
        Down
        ::

        Could you elaborate a little bit on why early and late (virtual) binding is an example of the principle “pay only for the features you use”? You mentioned this example in the intro video on week 0 when talking about the principle above, specifically as an example of abstractions costing nothing at runtime.

      • #9168
        RainerRainer
        Keymaster
          Up
          0
          Down
          ::

          Here is the short answer. Late binding (virtuality) is typically implemented with a pointer indirection. You have to pay for this pointer, but sometimes you don’t need it. Therefore, you use in C++ by default, in contrast to Java or Python, early binding.
          Long answer: Wait for our inheritance lessons.

        • #9169
          Avatardiana
          Participant
            Up
            0
            Down
            ::

            Sounds good! Thanks Rainer

        Viewing 2 reply threads
        • You must be logged in to reply to this topic.