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 8432633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:10:51+00:00 2026-06-10T06:10:51+00:00

I am working on an assignment in C++, a language I am not particularly

  • 0

I am working on an assignment in C++, a language I am not particularly proficient in.

I am attempting to declare a dynamic array of ‘Account’ objects in a file main.cpp:

Account * acctArray = new Account[];

main.cpp includes Account.h:

class Account {
private:
    int customerID;
    int BSB;
    int acctNumber;
    string surname;
    string firstName;
    double balance;
    double withdrawn;
public:
    Account() {};
    //setters
    void setCustID(int ID);
    void setBSB(int inBSB);
    void setAcctNo(int number);
    void setSurname(string sname);
    void setFirstName(string fname);
    void setBalance(double bal);
    void setWithdrawn(double withd);
    //getters
    //(snipped for irrelevance)
    //methods
    bool withdraw(double amount);
};

However, when compiling on my uni’s unix machine (the machine the assignment must be submitted on), I get the following error:

“main.cpp”, line 130: Error: The type “Account[]” is incomplete.

I tried compiling with

Account * acctArray = new Account[5];

to see if I could isolate the problem, and this line compiled fine.

What am I doing wrong?? I fear the solution lies in pointers/references and my lack of understanding thereof.

  • 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-06-10T06:10:53+00:00Added an answer on June 10, 2026 at 6:10 am

    An array in C++ has a fixed size. There is no built-in “dynamic array” functionality. If you want a dynamic array, use a std::vector<Account>.

    I am working on an assignment in C++, a language I am not particularly proficient in.

    It is best to avoid new and explicit dynamic allocation wherever possible. If you think you need to dynamically allocate something using new and manage it yourself, there’s probably a better way to accomplish the task.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i`m working on my assignment for univ, and since some parts are not really
So I've been enjoying this challenging language, I am currently working on an assignment
I am working on a revision assignment for an exam on language theory. A
I am working on an assignment that specified Do not use any external libraries.
I'm working on my assignment of PHP course. The problem that I don't understand
I am working on an assignment and don't get answer for some of questions.
I am working on an assignment for networking where we are supposed to create
I am working on an assignment where one of the problems asks to derive
I am working on an assignment where I need to do calculations with large
I'm working on an assignment where i am supposed to display grocery items in

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.