Here’s an example:
struct I
{
virtual void method() = 0;
virtual void method( const char* something ) = 0;
};
class C : public I
{
void method() override
{
printf( "void" );
}
void method( const char* something ) override
{
printf( "string" );
}
};
The vtable order is flipped in the I
, the method with the string argument is before the method without arguments.
This only happens for methods with the same name.
Is there a compiler switch to prevent the compiler from reordering my methods, even if they have the same name?