Creating and managing classes and objects

After completing this chapter, you will be able to:

  • Define a class containing a related set of methods and data items.

  • Control the accessibility of members by using the public and private keywords.

  • Create objects by using the new keyword to invoke a constructor.

  • Write and call your own constructors.

  • Create methods and data that can be shared by all instances of the same class by using the static keyword.

  • Explain how to create anonymous classes.

The Windows Runtime together with the Microsoft .NET Framework contains thousands of classes. You have used a number of them already, including Console and Exception. Classes provide a convenient mechanism for modeling the entities manipulated by applications. ...

Get Microsoft Visual C# Step by Step, Ninth Edition now with the O’Reilly learning platform.

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