I am trying to create an 2 arrays, regDiceBag that holds 10 of my base class objects Die and another one that holds 5 of the base class and 5 derived class object LoadedDie. I don't know how I would create the second array, however, from past experience, the 1st array should be initialized like this: Die[] regDieBag[10]; and then when I want to fill it with the Die object in a for loop, i would do regDieBag[i] = new Die(6);. Well that's the way I though it should work, but I get this error when I compile my program:
DieTester.cpp: In function ‘int main()’:
DieTester.cpp:33: error: expected unqualified-id before ‘[’ token
DieTester.cpp:35: error: ‘regDieBag’ was not declared in this scope
I have tried other methods I found on google, some similar to this and some a bit different, but nothing seems to work for the 1st array. Could u please explain to me how I would go about creating the 2 arrays efficiently? Another thing, in the second array, it would be filled with Die and LoadedDie, how would I call the functions available to each class including the ones not inherited from base class (Die)?