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

Y

Yu Lianqing

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();
 
J

John Harrison

Yu Lianqing said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top