24.2.txt
来自「《Microsoft Visual C# .NET 2003开发技巧大全》源代码」· 文本 代码 · 共 80 行
TXT
80 行
Listing 24.2 Interface Declarations for a .NET Object
using System;
namespace DotNetObject
{
public interface IVehicle
{
int Wheels
{
get;
set;
}
}
public interface IAirVehicle : IVehicle
{
int Elevation
{
get;
set;
}
}
public interface IAirplane : IAirVehicle
{
int Capacity
{
get;
set;
}
}
public class Airplane : IAirplane
{
private int capacity, elevation, wheels;
public Airplane()
{
capacity = 200;
elevation = 0;
wheels = 4;
}
public int Capacity
{
get
{
return this.capacity;
}
set
{
this.capacity = value;
}
}
public int Elevation
{
get
{
return this.elevation;
}
set
{
this.elevation = value;
}
}
public int Wheels
{
get
{
return this.wheels;
}
set
{
this.wheels = value;
}
}
}
public class NonInterfaceClass
{
public void Test()
{
Console.WriteLine( “NonInterfaceClass.Test succeeded” );
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?