小编kay*_*ezy的帖子

'newacc'不是类或名称空间

嘿伙计们,我对OOP和c ++都很新,所以请耐心等待.

我正在尝试定义一个类,它的功能,然后使用它们.我会展示到目前为止我所遇到的以及我遇到错误的地方.

在名为"account.h"的文件中,我有:

#include <iostream>
#include <string>
using namespace std;

class Account{
string fname;
string lname;
string sinnum;
string accttype;
int numtrans;
double balance;

public:
Account(string,string,string,string);
double DepositAmt(double);
double WithdrawAmt(double);
void PrintStatement();
void getFinalBalance();
};
Run Code Online (Sandbox Code Playgroud)

在一个名为"account.cpp"的文件中,我有:

Account::Account(string firstname, string lastname, string sinnumber, string acc
{
fname = firstname;
lname = lastname;
sinnum = sinnumber;
accttype = accounttype;
numtrans = 0;
balance = 0;
}

double Account::DepositAmt(double deposit)
{
balance = balance + deposit;
return balance;
}

double Account::WithdrawAmt(double withdraw) …
Run Code Online (Sandbox Code Playgroud)

c++ compiler-errors method-call

0
推荐指数
1
解决办法
61
查看次数

标签 统计

c++ ×1

compiler-errors ×1

method-call ×1