10 Classes and Objects: A Deeper Look

Objectives

In this chapter you’ll:

  • Use composition to allow a class to have references to objects of other classes as members.

  • Throw an exception to indicate that an argument is out of range.

  • Enable an object to refer to itself with the keyword this.

  • Use static variables and methods.

  • Use readonly fields.

  • Take advantage of C#’s memory-management features.

  • Use the IDE’s Class View and Object Browser windows.

  • Use object initializers to create an object and initialize it in the same statement.

  • Overload built-in operators to work with objects of your own types.

  • Define your own value type with struct.

  • Use extension methods to enhance an existing class’s capabilities.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset