Adding to array in class, which also has an array. 
Author Message
 Adding to array in class, which also has an array.

Could you please tell me what I am doing wrong?
I get a compiler error on last line of code -
 C.aB.Add( B );
error C2664: 'Add' : cannot convert parameter 1 from 'class cB' to 'class

#include <afx.h>
#include <iostream.h>
#include <afxtempl.h>

class cA {
 void SetValue(CString str){m_strValue=str;}
 CString m_strValue;


class cB {
 CArray<cA, cA> aA;


class cC {
 CArray<cB, cB> aB;


// ------ Test --------
void test() {
 cA A;
 cB B;
 cC C;

 CString s = "Test String";

 A.SetValue( s );
 B.aA.Add( A );
 C.aB.Add( B );   // Error happens here


Tue, 12 Sep 2000 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Multiply and Add matrices with 2d array WITHOUT ARRAY INDEXING

2. Question about adding an array to existing array.

3. Adding new elements to array class instance?

4. char array (array of array...) question

5. Having a little trouble understanding Arrays and pointers...

6. Having difficulty creating a function that returns an array of structures

7. Array of structures having CString objects

8. Having problems copying a string array.

9. Constructing each instance of a class in an array of classes

10. Why does an array have no ADD method?

11. MD5 byte array to hex array

12. Implementing array of array


Powered by phpBB® Forum Software