Free mag vol1 | Page 15

 CONTENTS Understanding Read-Only Fields .......................................................................................................... 208 Static Read-Only Fields ........................................................................................................................ 209 Understanding Partial Types..........................................................................................210 Summary .......................................................................................................................211  Chapter 6: Understanding Inheritance and Polymorphism.................................213 The Basic Mechanics of Inheritance..............................................................................213 Specifying the Parent Class of an Existing Class.................................................................................. 214 Regarding Multiple Base Classes ......................................................................................................... 216 The sealed Keyword ............................................................................................................................. 216 Revising Visual Studio Class Diagrams .........................................................................218 The Second Pillar of OOP: The Details of Inheritance ....................................................220 Controlling Base Class Creation with the base Keyword...................................................................... 221 Keeping Family Secrets: The protected Keyword................................................................................. 223 Adding a Sealed Class .......................................................................................................................... 224 Programming for Containment/Delegation ....................................................................225 Understanding Nested Type Definitions .................................... ........................................................... 226 The Third Pillar of OOP: C#’s Polymorphic Support .......................................................228 The virtual and override Keywords....................................................................................................... 229 Overriding Virtual Members Using the Visual Studio IDE...................................................................... 231 Sealing Virtual Members ...................................................................................................................... 232 Understanding Abstract Classes........................................................................................................... 233 Understanding the Polymorphic Interface ............................................................................................ 235 Understanding Member Shadowing ..................................................................................................... 239 Understanding Base Class/Derived Class Casting Rules ...............................................240 The C# as Keyword............................................................................................................................... 242 The C# is Keyword................................................................................................................................ 243 The Master Parent Class: System.Object.......................................................................243 xiii