Code: int main() { D d; cout<<"size of d: "<<sizeof(d)<<endl;//8 cout<<"i: "<<d.i<<endl;//error return 0; } error: i is not member of D. but D is derived from B...i is in public part then why this error :thinking::thinking::thinking:
How can we debug code that you don't post? You're right though: it SHOULD work. So we need to see the code to find the problem. Try to cut B and D down to the least possible (ideally just the i definition).