首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

老大们 就这点分了!救命!该怎么解决

2012-01-26 
老大们 就这点分了!!!!!!!!!救命!!usingSystemusingSystem.Collections.GenericusingSystem.Textnamesp

老大们 就这点分了!!!!!!!!!救命!!
using   System;
using   System.Collections.Generic;
using   System.Text;

namespace   Wrox.ProCSharp
{
        public   interface   IBankAccount
        {
                void   PayIn(decimal   amount);         //存款的方法
                bool   Withdraw(decimal   amount);   //判断是否余款不足
                decimal   Balance                               //返回余款的属性
                {
                        get;
                }
        }
        public   interface   ITransferBankAccount   :   IBankAccount
        {  
                bool   TransferTo(IBankAccount   destination,   decimal   amount);
        }
       
        public   class   CurrentAccount   :   ITransferBankAccount
        {

                private   decimal   balance;
                public   void   PayIn(decimal   amount)
                {
                        balance   +=   amount;
                }
                public   bool   Withdraw(decimal   amount)
                {
                        if   (balance   > =   amount)
                        {
                                balance   -=   amount;
                                return   true;
                        }
                        Console.WriteLine( "转帐失败 ");
                        return   false;
           
                }
                public   decimal   Banlance
                {
                      get
                        {
                                return   balance;
                        }


                }
                public   bool   TransfertTo(IBankAccount   destination,   decimal   amount)
                {
                        bool   result;
                        if   ((result   =   Withdraw(amount))==true)
                        {
                                destination.PayIn(amount);
                                return   result;
 
                        }
                }
                public   override   string   ToString()
                {
                        return   String.Format( "Jupiter   Bank   Current   Account:   Balance   =   {0,6:C} ",   balance);
                }

              }
        class   MainEntryPoint
        {
                static   void   Main()
                {
                        IBankAccount   venusAccount   =   new   SaverAccount();   //以上已经详细说明表示他们可以指向实现这些接口的任何方法
                        ITransferBankAccount   jupiterAccount   =   new   CurrentAccount();
                        venusAccount.PayIn(200);
             
                        jupiterAccount.PayIn(500);
                        jupiterAccount.TransferTo(100);
                        Console.WriteLine(venusAccount.ToString());
                       
                        Console.WriteLine(jupiterAccount.ToString());
                }
        }


}

--------------------------
错误:
错误1“Wrox.ProCSharp.CurrentAccount”不会实现接口成员“Wrox.ProCSharp.ITransferBankAccount.TransferTo(Wrox.ProCSharp.IBankAccount,   decimal)”C:\Documents   and   Settings\Administrator\桌面\Chap4_Sample\bank_zhuanzhang\Class1.cs2118bank_zhuanzhang
错误2“Wrox.ProCSharp.CurrentAccount”不会实现接口成员“Wrox.ProCSharp.IBankAccount.Balance”C:\Documents   and   Settings\Administrator\桌面\Chap4_Sample\bank_zhuanzhang\Class1.cs2118bank_zhuanzhang


------解决方案--------------------


mark

热点排行