struct Entry
{
int Data0;
};
struct ExtendedEntry : public Entry
{
int Data1;
};
I have a simple method expecting a C-style array pointer to Entry like this
void Calculate(Entry* data, int count);
This method obviously fails, when passing a pointer to an array of ExtendedEntrys. How to prevent users from doing so?
ExtendedEntry items[50];
// [...]
Calculate(items, 50);
It's not that I pursue a bullet-proof API, I just want to prevent me and my co-workers from making the same mistake again.