CONTENTS
Chaining Constructor Calls Using this .................................................................................................. 172
Observing Constructor Flow ................................................................................................................. 174
Revisiting Optional Arguments ............................................................................................................. 176
Understanding the static Keyword.................................................................................177
Defining Static Field Data ..................................................................................................................... 178
Defining Static Methods ....................................................................................................................... 179
Defining Static Constructors................................................................................................................. 181
Defining Static Classes......................................................................................................................... 183
Defining the Pillars of OOP.............................................................................................184
The Role of Encapsulation .................................................................................................................... 185
The Role of Inheritance......................................................................................................................... 185
The Role of Polymorphism.................................................................................................................... 187
C# Access Modifiers ......................................................................................................188
The Default Access Modifiers............................................................................................................... 189
Access Modifiers and Nested Types..................................................................................................... 189
The First Pillar: C#’s Encapsulation Services.................................................................190
Encapsulation Using Traditional Accessors and Mutators.................................................................... 191
Encapsulation Using .NET Properties ................................................................................................... 193
Using Properties Within a Class Definition ........................................................................................... 196
Read-Only and Write-Only Properties................................................................................................... 198
Revisiting the static Keyword: Defining Static Properties .................................................................... 199
Understanding Automatic Properties.............................................................................199
Interacting with Automatic Properties.................................................................................................. 201
Regarding Automatic Properties and Default Values............................................................................ 201
Understanding Object Initialization Syntax ....................................................................203
Calling Custom Constructors with Initialization Syntax ........................................................................ 204
Initializing Inner Types.......................................................................................................................... 206
Working with Constant Field Data .................................................................................207
xii