Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6663299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:29:02+00:00 2026-05-26T02:29:02+00:00

I have to make a trivial class that has a few subclasses and one

  • 0

I have to make a trivial class that has a few subclasses and one of those subclasses has it’s own sublcass.

AccountClass.h

#ifndef Account_h
#define Account_h

class Account{

public:
    //Account(){balance = 0.0;}; Here's where the problem was
    Account(double bal=0.0){ balance = bal;};
    double getBal(){return balance;};

protected:
    double balance;
};
#endif

SavingsAccount.h

#ifndef SavingsAccount_h
#define SavingsAccount_h
#include "AccountClass.h"
class SavingsAccount : public Account{

public:
    //SavingsAccount(); And here
    SavingsAccount(double bal = 0.0, int pct = 0.0){ balance = bal; rate = pct; } : Account(bal);
    void compound(){ balance *= rate; };
    void withdraw(double amt){balance -= amt;};

protected:
    double rate;
};

#endif

CheckingAccount.h

#ifndef CheckingAccount_h
#define CheckingAccount_h
#include "AccountClass.h"
class CheckingAccount : public Account{

public:
    //CheckingAccount(); Here also
    CheckingAccount(double bal = 0.0, double lim = 500.0, double chg = 0.5){ balance = bal; limit = lim; charge = chg;} : Account(bal);
    void cash_check(double amt){ balance -= amt;};

protected:
    double limit;
    double charge;
};

#endif

TimeAccount.h

#ifndef TimeAccount_h
#define TimeAccount_h
#include "SavingsAccount.h"
class TimeAccount : public SavingsAccount{

public:
    //TimeAccount(); ;)
    TimeAccount(double bal = 0.0, int pct = 5.0){ balance = bal; rate = pct;} : SavingsAccount(bal,pct);
    void compound(){ funds_avail += (balance * rate); };
    void withdraw(double amt){funds_avail -= amt;};

protected:
    double funds_avail;
};

#endif

I keep getting errors that default constructors are defined as well as all the variables not existing…

Help!

Edit:

Fixed the preprocessor ifndef’s

Also, this was solved. Thanks @Coincoin!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:29:02+00:00Added an answer on May 26, 2026 at 2:29 am

    There are multiple errors in the way you defined your constructors.

    • Some of them don’t have a body defined
    • The intialisation lists are syntaxicaly not at the right place
    • You try to define two default constructor by using default valued parameters.

    The initialisation list goes between the signature and the body.

    Like so:

    SavingsAccount(double bal = 0.0, int pct = 0.0)
    :Account(bal)
    {
       balance = bal; rate = pct;
    }
    

    Also, you already have a default constructor yet you have parameter list with all parameters with default values, which means you are trying to define two default constructors. You either need to remove the default value for the bal parameter or remove the default constructor and use the entirely default valued constructor as the default constructor.

    Like so:

    Account(){balance = 0.0;};
    Account(double bal){ balance = bal;}
    

    or

    Account(double bal=0.0){ balance = bal;}  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that has some properties. And I want something that calculates
I have to make a schema for an XML format that's already being used.
When working in the unmanaged world, we have to make sure that we clean
I have a script that appends some rows to a table. One of the
I have to make column charts in Excel using VBA only (no user input).
I have a control which I have to make large modifications to. I'd like
For my university assignment I have to make a networkable version of pacman. I
In our application we sometimes have to make minor GUI modifications for different customers:
I'm working on an application where users have to make a call and type
I'm busy with an asignment where i have to make a graphical interface for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.