Can a class call its indirect base's member function?

Discussion in 'C++' started by Yu Lianqing, Jul 31, 2003.

  1. Yu Lianqing

    Yu Lianqing Guest

    In the following code segment, is the statement
    me.set();
    correct?

    class grandfather {
    ...
    void set();
    };

    class father : public grandfather {
    ...
    };

    class son : public father {
    ...
    };

    son me;
    me.set();
     
    Yu Lianqing, Jul 31, 2003
    #1
    1. Advertising

  2. "Yu Lianqing" <> wrote in message
    news:...
    > In the following code segment, is the statement
    > me.set();
    > correct?
    >
    > class grandfather {
    > ...
    > void set();
    > };
    >
    > class father : public grandfather {
    > ...
    > };
    >
    > class son : public father {
    > ...
    > };
    >
    > son me;
    > me.set();


    Assuming set is public, then yes.

    john
     
    John Harrison, Jul 31, 2003
    #2
    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.
Similar Threads
  1. Siemel Naran
    Replies:
    4
    Views:
    839
    Micah Cowan
    Jan 12, 2005
  2. Replies:
    2
    Views:
    856
    Noah Roberts
    Jun 9, 2006
  3. George2
    Replies:
    0
    Views:
    373
    George2
    Mar 17, 2008
  4. Albright
    Replies:
    3
    Views:
    462
    Alf P. Steinbach
    Feb 17, 2009
  5. K. Frank
    Replies:
    8
    Views:
    671
    K. Frank
    Mar 22, 2012
Loading...

Share This Page