1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

data member of base class but not of derive class..why?

Discussion in 'C++' started by zubairjam, Oct 3, 2010.

  1. zubairjam

    zubairjam New Member

    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:
    Last edited by a moderator: Oct 3, 2010
  2. xpi0t0s

    xpi0t0s Mentor

    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).
    shabbir likes this.

Share This Page