Although you can create an array of pointers for classes declared ahead, you cannot create an array with an unknown size. If you want to create an array at runtime, make a pointer to a pointer (which, of course, is also allowed):
Account **ownedAccounts; ... // Later on, in the constructor ownedAccounts = new Account*[numOwnedAccounts]; ... // Later on, in the destructor delete[] ownedAccounts;
source share