Classes

What are classes?

Classes are a core feature of Object Orientated Programming (OOP) languages. They are a logical grouping of methods and properties representing and encapsulating a problem concept. You've already met a class before, the  Program  class:

using System; public class Program { ...

 

In the above example, we've defined a class called  Program . The program class encapsulates our method  Main  which is the entry point to our application.

Many applications will use a lot of different classes, often representing a number of different concepts, from classes representing people, to shopping orders, cinema tickets, etc. 

Remember in our previous tutorial, Variables and Standard Types, we introduced the concept of value and reference types. All references types in the .NET framework are implemented as classes. When you define a class, you are explicitly saying that you want reference-type semantics.

Page 2 of 20