Virtual Inheritance

  • Thread starter Scott Brady Drummonds
  • Start date
S

Scott Brady Drummonds

Hi, everyone,

I was stumped at an interview several months ago when questioned about the
use of the keyword "virtual" when inheriting a base class into a derived
class. I was told by the interviewer that this was useful in some cases of
multiple inheritance. Now I'm wondering what those cases are, and how they
occur, and exactly what this usage does to rectify the problem.

Can anyone help me understand this or recommend a resource that can?

Thanks,
Scott
 
A

Artie Gold

Scott said:
Hi, everyone,

I was stumped at an interview several months ago when questioned about the
use of the keyword "virtual" when inheriting a base class into a derived
class. I was told by the interviewer that this was useful in some cases of
multiple inheritance. Now I'm wondering what those cases are, and how they
occur, and exactly what this usage does to rectify the problem.

Can anyone help me understand this or recommend a resource that can?

See:

http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.8

[In fact, reading the whole `chapter' -- and for that matter the rest of
the FAQ -- would likely be fruitful.]

HTH,
--ag
 
J

Jumbo

Artie Gold said:
Scott said:
Hi, everyone,

I was stumped at an interview several months ago when questioned about the
use of the keyword "virtual" when inheriting a base class into a derived
class. I was told by the interviewer that this was useful in some cases of
multiple inheritance. Now I'm wondering what those cases are, and how they
occur, and exactly what this usage does to rectify the problem.

Can anyone help me understand this or recommend a resource that can?

See:

http://www.parashift.com/c++-faq-lite/multiple-inheritance.html#faq-25.8

[In fact, reading the whole `chapter' -- and for that matter the rest of
the FAQ -- would likely be fruitful.]

HTH,
--ag

You sure know how to kill a good conversation.
 
E

E. Robert Tisdale

Scott said:
Ugh... Many apologies for asking a FAQ question.
I have the printed FAQ (C++ FAQs...)
and could not find this question there.
I'll be sure and check online next time, too.

It doesn't hurt to ask.
I just wish more C++ Gurus would read the C++ FAQ
so that they could cite relevant questions (answers)
the way that Artie Gold did above.

Way to go Artie!
 

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

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top