I have a class called personalAccount (which is a derived class from another class, but i dont think this will matter in this case), which should have a static array of chars, but i keep getting an error int my current default constructor and i cant seem to find the reason.

The code:

class header file

class personalAccount : public limit
               char* array;
               static int size;
               personalAccount(string name,double status,double limit1):limit(name,status,limit1){}

..and cpp file

int personalAccount::size=100;
//default constructor
               array=new char[size]; //this is the line where the error is supposed to be
               for(int i=0; i<size; i++)

The error i keep getting is: 'personalAccount::personalAccount(const personalAccount&)': cannot convert parameter 1 from int to const personalAccount&,

reason: cannot convert from 'int' to 'const personalAccount'
No constructor could take the source type, or constructor overload resolution was ambiguous.

Any advice would be much appriciated.

I suppose you are using the personalAccount somewhere, could you post that code, i.e.
if you have e.g. something like

int main()
    personalAccount Account;

Won't be neccessary, i checked my main function and realized i was using the wrong constructor when i was initilazing an object. Thanks for pointing me in the right direction.

This article has been dead for over six months. Start a new discussion instead.