10. Classes and Objects: A Deeper Look

Objectives

In this chapter you’ll:

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

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

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

Image Use static variables and methods.

Use readonly fields.

Get C# 6 for Programmers, Sixth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.