四、定义一个类实现如下接口:
using System;
namespace experiment3
{
public interface IBankAccount
{
void SaveIn(decimal amount);
bool WithDraw(decimal amount);
decimal Balance
{
get;
}
}
}
public interface IBankAccount
{
void SaveIn(decimal amount);
bool WithDraw(decimal amount);
decimal Balance { get; }
}
public class customer : IBankAccount
{
public void SaveIn(decimal amount)
{
this.Balance += amount;
}
public bool WithDraw(decimal amount)
{
if (amount <= Balance) { this.Balance -= amount;return true; }
return false;
}
public decimal Balance { get; set; }
}