O'Reilly logo

Visual C#® 2012: How to Program, Fifth Edition by Harvey Deitel, Paul Deitel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

10. Classes and Objects: A Deeper Look

But what, to serve our private ends, Forbids the cheating of our friends?

—Charles Churchill

This above all: to thine own self be true.

—William Shakespeare.

Objectives

In this chapter you’ll:

• Understand encapsulation and data hiding.

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

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required