![]() |
| | #1 |
| Registered User Join Date: Aug 2001
Posts: 109
| By the topic I mean structure like this: class A class B1 : virtual public A class B2 : virtual public A class C : public B1, public B2 I've been familiar to multiple virtual inheritance a while, and I've never run into any situation where it would've been needed. There has always been a simpler and working solution. Nor I've never thought of any possible situation where it'd been come handy. So could somebody give me an example or ideas where multiple virtual inheritance is needed. No code needed at all, just ideas and descriptions. Thanks.
__________________ Making error is human, but for messing things thoroughly it takes a computer |
| kitten is offline | |
| | #2 |
| Guest
Posts: n/a
| >>could somebody give me an example or ideas where multiple virtual inheritance is needed. iostream uses multiple inheritance and virtual base classes. Iostream is derived from both istream and ostream, and both istream and ostream are derived from ios. class ios { . . . }; // base class class istream : virtual public ios { . . . }; // derived class ostream : virtual public ios { . . . }; // derived class iostream : public istream, public ostream { . . . }; // derived I can't say such a thing is ever needed, but it is a tool with an appropriate built-in safegaurd. hth, |
|
| | #3 |
| Guest
Posts: n/a
| Forgive the unregistered response. I was unaware my user name would post as "unregistered." My apologies, Ted |
|
| | #4 |
| Registered User Join Date: Aug 2001
Posts: 403
| i find that i've gone to far if i'm ever doing something close to this i usually turn around.. in my opinion i'm just destroying the beauty of encapsulation. (at least for the kinda stuff i do) |
| cozman is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple inheritance: casting yields different address | dwks | C++ Programming | 16 | 06-08-2009 03:03 PM |
| Abnormal Program Termination when executed from C:\Program Files\... | m37h0d | Windows Programming | 48 | 09-26-2008 03:45 AM |
| Virtual function and multiple inheritance | George2 | C++ Programming | 68 | 02-13-2008 01:15 AM |
| C++ XML Class | edwardtisdale | C++ Programming | 0 | 12-10-2001 11:14 PM |
| Exporting Object Hierarchies from a DLL | andy668 | C++ Programming | 0 | 10-20-2001 01:26 PM |