SoFunction
Updated on 2025-03-08

Detailed explanation of examples based on c# interface


namespace ConsoleApplication1
{
    using System;
    using ;
    using ;
    public class BankMethod : IBankAccount
    {
        decimal balance;
        public void PayIn(decimal Account)
        {
            balance += Account;
//("Your current deposit is: {0}",balance);
        }
        public bool PayOut(decimal Account)
        {
            if (Balance > Account)
            {
                balance -= Account;
("You have taken away {0}, and the remaining balance is: {1}", Account, balance);
                return true;
            }
("Get withdrawal failed!");
            return false;
        }
        public decimal Balance
        {
            get { return balance; }
        }
        public override string ToString()
        {
return ("Your current deposit is: {0:C}", balance);
        }
    }
    class Test
    {
        static void Main()
        {
            IBankAccount Huguo = new BankMethod();
            IBankAccount guo = new BankMethod();
            (10000);
            (200000);
            (());
            (());
            //BankMethod Bank = new BankMethod();
            //(200000);
            //(30000);
        }
    }
}