Книги автора: C# 2008 Programmer
Книга: C# 2008 Programmer
Defining a Class
Defining a Class
You use the class
keyword to define a class. The following example is the definition of a class called Contact
:
public class Contact {
public int ID;
public string FirstName;
public string LastName;
public string Email;
}
This Contact class has four public members — ID
, FirstName
, LastName
, and Email
. The syntax of a class definition is:
<access_modifiers> class Class_Name{
//---Fields, properties, methods, and events---
}