11.07.2015 Views

tYSR20

tYSR20

tYSR20

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 29: Ten Ways to Avoid Adding Bugs to Your Program 383Avoiding Multiple InheritanceMultiple inheritance, like operator overloading, adds another level of complexitythat you don’t need to deal with when you’re just starting out.Fortunately, most real-world relationships can be described with single inheritance.(Some people claim that multiple inheritance is not necessary at all —I’m not sure that I’m not one of them.)Feel free to use multiple-inherited classes from commercial libraries. Forexample, the Microsoft MFC classes that are key to Visual Studio 6 makeheavy use of multiple inheritance. Microsoft has spent a considerable amountof time setting up its classes, and it knows what it’s doing.After you feel comfortable with your level of understanding of C++, experimentwith setting up some multiple inheritance hierarchies. That way, you’llbe ready when the unusual situation that requires multiple inheritance todescribe it accurately arises.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!