i want to create an array of a certain amount of classes, which will be decided by the user. How do i go about this? simply typing
cin>>nCnt
CClass test[nCnt]
was not succesful. Thanks in advance for your help
You'll need to dynamically allocate and destroy the classes (using new and delete) after the user inputs the number.
[ignore]
CClass* pTest = (CClass*) new CClass[nCnt];
...
delete [] pTest;
[/ignore]
Use the arrow -> operator rather than the dot . operator to access the class members and functions.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.