Classes Part 2

Learning Objectives

By the end of this chapter, you should understand:

  1. How to customize fields with the keywords readonly and static.
  2. How to add methods to a class and call those methods.
  3. The difference between instance methods and static methods.
  4. How to override the default ToString and Equals methods for a class.
  5. How to auto-generate an Equals method in Visual Studio.

Key Terminology

Customizing Fields

  1. readonly field
  2. static field
  3. const

Customizing Methods

  1. static method
  2. Class method

Special Methods

  1. override
  2. ToString method
  3. Overriding
  4. Cast
  5. Equality
  6. Identity
  7. Equals method