I wanted to do an application that can create databases and manipulates them....
Needs to store all databases..
I thought of doing it by using CArray class. So I could use one CArray object to store all details of one database..Then how can I store details of many database having different no. of fields...?
Is it possible using CObArray class?
Whether I can store my CArray objects in CObArray objects..?
I mean :
CArray<CStoreItem, CStoreItem&> StoreItems;
CObArray<CArray, CArray*>database ;
It is showing some error.. "class CObArray may not have a template argument list".
Someone help me please..
I am using Visual Studio 2010. I have created a normal program to add details to a database using CArray class.
After that I tried to modify the code so that it can be used to store details of many databases having different no. of fields.
Thus I inserted "CObArray<CArray, CArray*>database;"
Then the error occured...
CObArray is an array of CObjects, so it doesn't have a template declaration.
This means that it will work for anything derived from CObject, but you have to cast the elements before you use them.
CArray* pArray = (CArray*)database;
I think Viorel_'s suggestion is a good one.
- Edited by Ante Meridian Monday, November 21, 2011 7:11 AM Fixed a typo.
On 21/11/2011 05:21, shaiby wrote:> CArray<CStoreItem, CStoreItem&> StoreItems;>> CObArray<CArray, CArray*>database ;>> It is showing some error.. "class CObArray may not have a template> argument list".>> Someone help me please..>I'd suggest to use STL container classes like std::vector.They are more flexible and composable than old MFC containers.Note that with r-value references and move semantics introduced in VC10,composing STL containers can also result in efficient code.Giovanni