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.

Table of ContentsxiDeclaring Static Member Functions...........................................................255What Is This About, Anyway?.....................................................................258Part IV: Inheritance...................................................259Chapter 20: Inheriting a Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .261Do I Need My Inheritance? ..........................................................................262How Does a Class Inherit?...........................................................................263Using a subclass .................................................................................265Constructing a subclass ....................................................................265Destructing a subclass.......................................................................267Having a HAS_A Relationship .....................................................................267Chapter 21: Examining Virtual Member Functions: Are They for Real? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .269Why You Need Polymorphism....................................................................272How Polymorphism Works .........................................................................274When Is a Virtual Function Not?.................................................................276Considering Virtual Considerations ..........................................................277Chapter 22: Factoring Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .279Factoring .......................................................................................................279Implementing Abstract Classes..................................................................284Describing the abstract class concept ............................................286Making an honest class out of an abstract class............................287Passing abstract classes....................................................................289Declaring pure virtual functions — is it really necessary? ...........290Factoring C++ Source Code .........................................................................291Dividing the program — Student......................................................292Defining a namespace ........................................................................293Implementing Student........................................................................294Dividing the program — GraduateStudent .....................................295Implementing an application ............................................................296Project file ...........................................................................................298Creating a project file under Dev-C++ ..............................................298Part V: Optional Features...........................................303Chapter 23: A New Assignment Operator, Should You Decide to Accept It . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .305Comparing Operators with Functions .......................................................305Inserting a New Operator............................................................................306

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

Saved successfully!

Ooh no, something went wrong!