The exact rules that determine when members from inherited base types are introduced to Swift’s representation of the C++ type are not yet finalized in Swift 5.9. This issue tracks their finalization.
The current rules need to be updated to handle shadowing better. For example, given the following C++ code:
class Plant {
public:
void water(float amount) { moisture += amount; }
private:
float moisture = 0.0;
};
class Fern: public Plant {
public:
void trim();
void water(float amount);
};
A user in Swift won't be unable to call the water method on a Fern object, as Swift will think it's an ambiguous call.