using System;
using System.Collections.Generic;
using System.Text;
namespace Bank
{
public class Overdraft : Account
{
double credit;
double inter = 0.15;
public double Credit
{
get { return credit; }
}
public Overdraft()
{
}
public Overdraft(String acno, String nam, double amt, double cred)
: base(acno, nam, amt)
{
this.credit = cred;
}
public override bool deposit(double amount)
{
amt += amount;
return true;
}
public override bool withdraw(double amount)
{
if (amount <= (credit + amt))
{
amt -= amount;
if (amt < 0)
{
credit -= Math.Abs(amt);
due = Math.Abs(amt);
interest();
}
return true;
}
else
Console.WriteLine("\n!!!!Credit Limit Crossed!!!!");
return false;
}
public void interest()
{
due = due * inter;
Console.WriteLine("The Interest for due amount is Rs. {0}", due);
return true;
}
public override string ToString()
{
return string.Format("Account Details: \nACC NO = {0} \nName = {1} \nBalance = Rs. {2}\nCredit =Rs. {3} \n", accno, name, amt, credit);
}
}
以上是我的代碼的dll類之一。問題是我應該如何傳遞Windows窗體中的Console.Writeln語句以及ToString方法。或者任何人都可以告訴我如何在消息框中的表單中獲得這些聲明。
你肯定需要花更多的時間在設計上,你寫的東西沒什麼意義。發現難以使用的是自動結果。使用像codereview.stackexchange.com這樣的網站找到願意審查並提出改進建議的人。 – 2013-04-24 13:29:01