Chapter 4. Introduction to Classes, Objects, Methods and strings

 

Nothing can have value without being an object of utility.

 
 --Karl Marx
 

Your public servants serve you right.

 
 --Adlai E. Stevenson
 

You’ll see something new. Two things. And I call them Thing One and Thing Two.

 
 --Dr. Theodor Seuss Geisel

Objectives

In this chapter you’ll learn:

  • How to declare a class and use it to create an object.
  • How to implement a class’s behaviors as methods.
  • How to implement a class’s attributes as instance variables and properties.
  • How to call an object’s methods to make them perform their tasks.
  • What instance variables of a class and local variables of a method are.
  • How to use a constructor to initialize an object’s data.

Outline

Get Visual C# 2010: How to Program, Fourth Edition now with O’Reilly online learning.

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