C#的新手,今天我已经在这里发布了一次,我感谢所有的帮助!我有一个我在Visual Basic中创建的程序.窗体有一个主表-的AccountForm.cs,三道关拍表格- WithdrawlForm.cs,DepositForm.cs和InterestForm.cs.我有两个类,Account.cs及其派生类SavingsAccount.cs.我试图将InterestRate下面的字符串更改为用户输入的利率InterestForm.此代码位于SavingsAccount类.cs文件中.
public new string toString()
{
return String.Format("Account Number: {0} Balance: {1:C} Interest Rate: {2:P}", AccountNumber, AccountBalance, InterestRate);
}
Run Code Online (Sandbox Code Playgroud)
完整的SavingsAccount.cs文件
namespace Assignment_6_third_attempt
{
public class SavingsAccount : Account
{
private InterestForm interestForm = new InterestForm();
private double interestRate = 0.0;
#region Constructors
public SavingsAccount(int accountNumber)
{
base.accountNumber = accountNumber;
}
public SavingsAccount() { }
#endregion
double InterestRate
{
get { return interestForm.interestRate ; …Run Code Online (Sandbox Code Playgroud) c# ×1