Dynamic Dispatch
摘要
Dynamic dispatch, selecting which function is called at runtime based on the type of some object (a.k.a. polymorphism), is one of the defining traits of object-oriented programming. While many languages support dynamic dispatch, each in different ways with its own trade-offs, C does not. However, you can implement it in the style of any programming language that does support it. This chapter illustrates two such styles: virtual function tables and fat pointers.