In Brief

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 ...

Get Microsoft® Visual C#® .NET 2003 Kick Start now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.