June 2003
Intermediate to advanced
624 pages
12h 41m
English
This chapter covered the essentials of C# OOP, starting with creating classes and objects. We saw that access modifiers let you restrict access to the members of classes and structs, encapsulating your data and methods as needed. Here's an overview of the topics we covered:
We can add fields, methods, and properties to classes, and we can initialize fields with initializers. We can use the this keyword in methods, and create not only standard properties, but also read-only and static properties. And we can create constructors and copy constructors to initialize the data in objects.
Static members are declared with the static keyword, and are associated with the class itself, not with objects created from that class. Static fields can ...