1. attributes and constructors Class Computer
{
Private String Name;
Public String Name
{
Get
{
Return Name;
}
Set
{
Name = Value;
}
}
Public String Motherboard = " AA SA " ;
Public Computer ( String Name)
{
This . Name = Name;
}
}
2. Inheritance
C # only supports single inheritance, but can inherit multiple interfaces
2.1 single inheritance ClassA
{
Public StringName {Get;Set;}
}
ClassB:
{
}
More than 2.2 inheritance, ClassA
{
Public StringName {Get;Set;}
}
InterfaceInterfacea
{
VoidMethoda ();
}
class B: A, interfacea
{< br> Public void methoda () {
///
}< br>
}
2.3 InterfaceInterfaceb
{
VoidMethodb ();
}
Class C: A, interfacea, interfaceb
{
Public Void Methoda ()
{
//
}
Public Void Methodb ()
{
//
}
}
3. Class Modification
Public class classname {}
Public static class classname {}
Public sealed class classname {} cannot be inherited
The public partial class classname {} Local type allows us to divide a class, structure, or interface into several parts, which are implemented in several different. in the CS file, the local types of each part are still merged into a complete class during compilation. The modifier partial must exist before each class of the same type.
Restrictions on local partial
(1) local types are only applicable to classes, interfaces, and structures. Delegation and enumeration are not supported.
(2) Each part of the same type must have a modifier partial.
(3) When using a local type, each part of a type must be in the same namespace.
(4) Each part of a type must be compiled at the same time.
From: http://www.cnblogs.com/beniao/archive/2008/07/26/1249030.html