4. Introduction to Classes and Objects

Objectives

In this chapter you’ll learn:

• What classes, objects, methods and instance variables are.

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

• The differences between instance variables of a class and local variables of a method.

• How to use a constructor to ensure that an object’s data is initialized when the object is created.

• The differences between value types and reference types.

Nothing can have value without being an object of utility.

Karl Marx

Your public servants serve you right. ...

Get C# 2010 for Programmers, Fourth 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.