difference between class B and Class C

Discussion in 'C++' started by Pallav singh, Mar 26, 2009.

  1. Pallav singh

    Pallav singh Guest

    what is the difference between class B and Class C w.r.t. void func( )
    { }


    Class A{
    Public :
    Virtual void func( ){ }
    }

    Class B : public A{
    Public :
    Virtual void func( ){ }
    }

    Class C : public A{
    Public :
    void func( ){ }
    }
     
    Pallav singh, Mar 26, 2009
    #1
    1. Advertising

  2. * Pallav singh:
    > what is the difference between class B and Class C w.r.t. void func( )
    > { }
    >
    >
    > Class A{
    > Public :
    > Virtual void func( ){ }
    > }
    >
    > Class B : public A{
    > Public :
    > Virtual void func( ){ }
    > }
    >
    > Class C : public A{
    > Public :
    > void func( ){ }
    > }


    This looks like a homework assignment.

    Since the code contains numerous typos you haven't tried this.

    The best way to proceed is to try it.


    Cheers & hth.,

    - Alf

    --
    Due to hosting requirements I need visits to <url: http://alfps.izfree.com/>.
    No ads, and there is some C++ stuff! :) Just going there is good. Linking
    to it is even better! Thanks in advance!
     
    Alf P. Steinbach, Mar 26, 2009
    #2
    1. Advertising

  3. Pallav singh

    Pallav singh Guest

    On Mar 26, 11:09 am, "Alf P. Steinbach" <> wrote:
    > * Pallav singh:
    >
    >
    >
    > > what is the difference between class B and Class C w.r.t.  void func( )
    > > {  }

    >
    > > Class A{
    > >     Public :
    > > Virtual void func( ){  }
    > > }

    >
    > > Class  B : public A{
    > >     Public :
    > > Virtual void func( ){  }
    > > }

    >
    > > Class  C : public A{
    > >     Public :
    > > void func( ){  }
    > > }

    >
    > This looks like a homework assignment.
    >
    > Since the code contains numerous typos you haven't tried this.
    >
    > The best way to proceed is to try it.
    >
    > Cheers & hth.,
    >
    > - Alf
    >
    > --
    > Due to hosting requirements I need visits to <url:http://alfps.izfree.com/>.
    > No ads, and there is some C++ stuff! :) Just going there is good. Linking
    > to it is even better! Thanks in advance!


    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    +

    Is is something related to Sharing / Non-sharing of VTBL ?
     
    Pallav singh, Mar 26, 2009
    #3
  4. Pallav singh

    Guest

    On Mar 26, 11:55 am, Pallav singh <> wrote:
    > [ ... ]


    A function once virtual, always a virtual!

    >Is is something related to Sharing / Non-sharing of VTBL

    Nope

    Regards,
    Abhay
     
    , Mar 26, 2009
    #4
  5. Pallav singh

    red floyd Guest

    Pallav singh wrote:
    > [redacted]


    > Is is something related to Sharing / Non-sharing of VTBL ?


    A vtbl is something you should never be concerned about directly.
    It's an implementation detail at best. Since the Standard doesn't
    require a vtbl, an implementation is free not to provide one.

    As has been mentioned before, I (and others) can imagine implementations
    of varying quality which provide no vtbl at all.
     
    red floyd, Mar 26, 2009
    #5
  6. Pallav singh

    red floyd Guest

    red floyd wrote:
    > Pallav singh wrote:
    >> [redacted]

    >
    >> Is is something related to Sharing / Non-sharing of VTBL ?

    >
    > A vtbl is something you should never be concerned about directly.
    > It's an implementation detail at best. Since the Standard doesn't
    > require a vtbl, an implementation is free not to provide one.
    >
    > As has been mentioned before, I (and others) can imagine implementations
    > of varying quality which provide no vtbl at all.
    >


    Correction. A vtbl is something you should never be concerned about
    directly, unless you are writing a compiler.
     
    red floyd, Mar 26, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page