What Do We Use Classes For?
All C# programs are composed of classes. The Windows forms we have just seen are classes, derived from the basic Form class and all the other programs we will be writing are made up exclusively of classes. C# does not have the concept of global data modules or shared data that is not part of classes.
Simply put, a class is a set of public and private methods and private data grouped inside named logical units. Usually, we write each class in a separate file, although this is not a hard and fast rule. We have already seen that these Windows forms are classes, and we will see how we can
create other useful classes in this chapter.
When you create a class, it is not a single entity, but a master you can create copies or instances of, using the new keyword. When we create these instances, we pass some initializing data into the class using its constructor. A constructor is a method that has the same name as the class
name, has no return type and can have zero or more parameters that get passed into each instance of the class. We refer to each of these instances as objects.