|
Inheritance vs Interface Polymorphism (C)
Doxygen docs for the C implementation
|
| CAbstractAnimal | Abstract base "class" combining shared state and an abstract speak function pointer |
| CAnimal | Base "class" simulated as a struct holding a speak function pointer |
| CCat | "Subclass" of Animal that meows |
| CDog | "Subclass" of Animal that barks |
| CDogWithDefault | Concrete AbstractAnimal "subclass" that implements speak() |
| CInterfaceCat | ISpeaker implementation that meows |
| CInterfaceDog | ISpeaker implementation that barks |
| CISpeaker | Interface contract simulated as a struct holding only a function pointer |
| CPureBreedDog | The sole concrete "speaker" type; no vtable is needed |