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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yu Lianqing

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

    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();
  • John Harrison

    #2
    Re: Can a class call its indirect base's member function?


    "Yu Lianqing" <yulianqing74@n etscape.net> wrote in message
    news:66251dc4.0 307310624.6c3f9 23d@posting.goo gle.com...[color=blue]
    > 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();[/color]

    Assuming set is public, then yes.

    john


    Comment

    Working...