Winforms 从dll访问返回语句到windows窗体 使用系统; 使用System.Collections.Generic; 使用系统文本; 名称空间库 { 公共类透支:账户 { 双重信用; 双区间=0.15; 公共双重信贷 { 获取{返回信用;} } 公共透支 { } 公共透支(字符串acno、字符串nam、双倍金额、双倍信用) :基准(acno、nam、amt) { 这个信用=信用; } 公共银行存款(双倍金额) { 金额+=金额; 返回true; } 公共覆盖bool提款(双倍金额) { 如果(amount
不在dll中使用Console.WriteLine。UI(WinForms)中的客户端代码应检查布尔返回值/callWinforms 从dll访问返回语句到windows窗体 使用系统; 使用System.Collections.Generic; 使用系统文本; 名称空间库 { 公共类透支:账户 { 双重信用; 双区间=0.15; 公共双重信贷 { 获取{返回信用;} } 公共透支 { } 公共透支(字符串acno、字符串nam、双倍金额、双倍信用) :基准(acno、nam、amt) { 这个信用=信用; } 公共银行存款(双倍金额) { 金额+=金额; 返回true; } 公共覆盖bool提款(双倍金额) { 如果(amount,winforms,c#-4.0,Winforms,C# 4.0,不在dll中使用Console.WriteLine。UI(WinForms)中的客户端代码应检查布尔返回值/callToString(),并向用户提供相关信息 < P > >考虑将双倍变为小数以存储量.< /p> @ Jacob Konecki如何在上面的代码中写入WistFrm中的ToStand方法?任何示例?最后,我将更改为十进制,最后感谢建议。@ ChetanGoenka代码> VaR OrdRavaTcTe=新的OutDRAF();OutDrAfEnt}.ToStRun();-只需获取r
ToString()
,并向用户提供相关信息
< P > >考虑将双倍变为小数以存储量.< /p> @ Jacob Konecki如何在上面的代码中写入WistFrm中的ToStand方法?任何示例?最后,我将更改为十进制,最后感谢建议。@ ChetanGoenka代码> VaR OrdRavaTcTe=新的OutDRAF();OutDrAfEnt}.ToStRun();-只需获取rout account的实例并调用
ToString()
。你肯定需要花更多的时间在设计上,你写的东西没有什么意义。发现它很难使用是自动的结果。使用codereview.stackexchange.com这样的网站,找到愿意审阅并提出改进建议的人。
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);
}
}