C# class
Description
Classes are essentially templates from which you can create objects.
A class is the most common kind of reference type.
Syntax
The simplest possible class declaration is as follows:
class YourClassName
{
}
The general syntax to declare a class is
[public, //from w ww . ja v a2 s. c o m
internal,
abstract,
sealed,
static,
unsafe,
partial] class YourClassName [ Generic type parameters, a base class, and interfaces]{
methods,
properties,
indexers,
events,
fields,
constructors,
operator functions,
nested types,
a finalizer
}
Example
In the following code we define a class named Person.
class Person
{
}