📄 24.2.txt
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -