- 29. April 2022 at 15:09 #9166dianaParticipant::
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.
- 29. April 2022 at 15:45 #9168RainerKeymaster::
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.
- 29. April 2022 at 20:38 #9169
- You must be logged in to reply to this topic.