Swift/C++ interop and polymorphism

Hi,

I have begun playing around with Swift/C++ interop and am currently wondering how polymorphism of C++ classes works in a Swift context, e.g. passing a concrete C++ subclass instance to a method that is declared using a parameter of an abstract base class. Unfortunately, I could not get it to work at all, is there a way to do this in the current version of Swift/C++ interop?

Thanks!

Best, ilu

This is not something that currently works in the current version of Interop. At the moment a lot of parent methods get consumed into a child instance without any inheritance hierarchy (hierarchy sorta gets flattened). I know @zoecarver and @John_McCall might have some ideas around this moving forward.

It's something we want to make work, but yeah, there are known problems here.

1 Like

Hey, just as a follow up, did you ever get this working?