Your declaration of Fruit
probably contains at least a virtual function.
In common implementations of virtual functions a virtual table is used. A pointer to the virtual table is stored as the first element in the memory representation of your object. It doesn't matter where you declare a virtual function, the virtual table will always be at the beginning.
So by declaring a virtual function in InTheMatrixFruit
you create a "padding" before the int vitamins
so it matches with the vitamins
of Fruit
.