8 | Operator Overloading; String and Array Objects | 546 |
8.1 | Introduction | 547 |
8.2 | Fundamentals of Operator Overloading | 548 |
8.3 | Restrictions on Operator Overloading | 549 |
8.4 | Operator Functions as Class Members vs. as friend Functions | 550 |
8.5 | Overloading Stream-Insertion and Stream-Extraction Operators | 552 |
8.6 | Overloading Unary Operators | 555 |
8.7 | Overloading Binary Operators | 555 |
8.8 | Case Study: Array Class | 556 |
8.9 | Converting between Types | 568 |
8.10 | Case Study: String Class | 569 |
8.11 | Overloading ++ and -- | 581 |
8.12 | Case Study: A Date Class | 582 |
8.13 | Standard Library Classes string and vector | 588 |
9 | | 609 |
9.1 | Introduction | 610 |
9.2 | Base Classes and Derived Classes | 611 |
9.3 | protected Members | 614 |
9.4 | Relationship between Base Classes and Derived Classes | 614 |
9.5 | Case Study: Three-Level Inheritance Hierarchy | 637 |
9.6 | Constructors and Destructors in Derived Classes | 642 |
9.7 | "Uses A" and "Knows A" Relationships | 648 |
9.8 | public, protected and private Inheritance | 648 |
9.9 | Software Engineering with Inheritance | 649 |
9.10 | [Optional Case Study] Thinking About Objects: Incorporating Inheritance into the Elevator Simulation | 650 |
10 | Object-Oriented Programming: Polymorphism | 662 |
10.1 | Introduction | 663 |
10.2 | Relationships Among Objects in an Inheritance Hierarchy | 664 |
10.2.1 | Invoking Base-Class Functions from Derived-Class Objects | 665 |
10.2.2 | Aiming Derived-Class Pointers at Base-Class Objects | 670 |
10.2.3 | Derived-Class Member-Function Calls via Base-Class Pointers | 672 |
10.2.4 | Virtual Functions | 673 |
10.3 | Polymorphism Examples | 679 |
10.4 | Type Fields and switch Structures | 680 |
10.5 | Abstract Classes | 680 |
10.6 | Case Study: Inheriting Interface and Implementation | 682 |
10.7 | Polymorphism, Virtual Functions and Dynamic Binding "Under the Hood" | 695 |
10.8 | Virtual Destructors | 699 |
10.9 | Case Study: Payroll System Using Polymorphism and Run-Time Type Information with dynamic_cast and typeid | |
11 | Templates | 718 |
11.1 | Introduction | 719 |
11.2 | Function Templates | 720 |
11.3 | Overloading Function Templates | 723 |
11.4 | Class Templates | 723 |
11.5 | Class Templates and Nontype Parameters | 730 |
11.6 | Templates and Inheritance | 731 |
11.7 | Templates and Friends | 731 |
11.8 | Templates and static Members | 732 |