Hi
I'm having some trouble trying to figure out my syntax error on my code. I have inspected it many times, but I can't seem to find my error. The compiler that I am using is from the Visual Studio 2005.
Here's the error message that I receive:
Error 2 error C2143: syntax error : missing ';' before 'SavingsAccount::{ctor}'
Here's my code:
class Account
class SavingsAccountCode:#include "Account.h" #include <iostream> using std::cout; Account::Account(double total) { if(total <= 0.0) { cout << "Your balance is less than or equal to zero"; this->balance = 0.0; } this->balance = total; } void Account::setBalance(double balanceAmount) { this->balance = balanceAmount; } double Account::getBalance() const { return this->balance; } double Account::credit(double add) { double result; result = this->balance + add; return result; } bool Account::debit(double minus) { if(minus > balance) { cout << "Debit amount exceeded account balance."; return false; } balance = balance - minus; return true; }
Code:#include "SavingsAccount.h" #include <iostream> using std::cout SavingsAccount::SavingsAccount(double balances, double rate):Account(balances) { this->setBalance(balances); this->interest = rate; } void SavingsAccount::setInterest(double rates) { this->interest = rates; } double SavingsAccount::getInterest() { return this->interest; } double SavingsAccount::calculateInterest() { double result; result = this->getBalance() * this->interest; return result; }



LinkBack URL
About LinkBacks



