Hello!
i've been working on a code and I tried to declare an array of objects inside the private of another class,
I have a class called Contacts which goes like this,
But when I compile this code I get the following error:
D:\C++ Project\test.cpp|49|error: data member may not have variably modified type `Contact[(((unsignedint)((AddressBook::n <unknown operator> 1), 0)) + 1u)]'|
How do I declare an array of objects inside another class?
This needs to be refined a bit and there are a couple of bloopers but the essence is there. The 'essence' here means you don't create the actual array in the addressbook but refer to it by pointers. It becomes cumbersome to keep track of entries so, vectors aren't a bad move unless you want the challenge. You could also do it with a linked list of your own design.