replacement for oop?
Tagged unions with forwarding methods
Alright I have no idea what that is
struct MyInterface { MyInterfaceTag tag; union { ...variants }; }; MyInterface_doThing(union MyInterface x) { switch (x.tag) { case MyInterfaceId_Foo: return Foo_doThing(x.foo); ...variants } }
Обсуждают сегодня