Introduction to Classes
This lesson discusses classes, their definition, and declaration of classes in detail using an example.
We'll cover the following...
Definition
As in other object-oriented programming languages, the functionality of a C# program is implemented in one or more classes.
The methods and properties of a class contain the code that defines how the class behaves.
Several types of C# classes can be defined, including instance classes (standard classes that can be instantiated), static classes, and structures.
Declaring a Class
Skeleton of declaring class is:
Press + to interact
//whatever is written inside [] is optional while declaring a class//whatever is written inside <> is required while declaring a class[private/public/protected/internal] class <Desired Class Name> [:[Inherited class][,][[Interface Name 1],[Interface Name 2],...]{//Your code}
-
Classes are defined using the ...