Well first, you of course need the 'core' language with the crossplatform code to run on all the platforms (c++ in your example).
Then, you might have more cross platform code written in another language. Communication with these depends on the language and the "FFI" mechanism it implements as explained (usually calling C-like simple functions is supported, possibly with special requirements/constraints to make sure it works properly).
Then, there might be platform dependent libraries written in another language OR the same core language. With C++, you would write the code for each such platform dependent library, and then at compile time choose which piece of code you want to compile using preprocessor directives (if its windows, use this block of code, if its mac, use this next one and so on). This would be done such that whatever platform dependent library you choose, the interface is the same, so the cross platform code can use it the same way (eg you might have a function that does something, and the implementation of it changes depending on platform. So the interface doesnt change)
Though just because the interface for such a cross platform functionality implemented differently for each platform doesnt change, its behavior might. Eg if it was some kind of rendering class, on one platform it would report that it supports some maximum size of texture, and another platform the maximum size might be different. But thats a part of the interface so its ok.