In article <11eh…@raubtier-asyl.eternal-september.org>, Bonita Montero <Boni…@gmail.com> wrote:
>Am 29.11.2026 um 20:21 schrieb Lawrence D’Oliveiro: >
>> On Sun, 29 Nov 2026 20:08:10 +0100, Bonita Montero wrote:
>
>>> Virtual functions in C++ need less storage since you need only one >>> virtual method table pointer per baseclass.
>
>> That’s actually a limitation, because it disallows “monkey-patching”.
> >When do you need to change the polymorphic type of a class at >runtime. In OOP languages no one has missed that feature so far.
It's actually not even that hard. Most class instances have a single pointer to a vtbl; you can "monkey patch" C++ just by replacing that with a pointer to a different table that points to a different thunk. To bring this back to C, though, space-efficient dispatch through function pointers has been part of the language since nearly the beginning: consider the device switches in early Unix. - Dan C.