CArray



 DEVELOP > c-Plus-Plus > CArray

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "Dymus"
Date: 12 Aug 2007 02:44:22 PM
Object: CArray
Ok here is sample of code:
CArray <MyClass,MyClass> arr;
MyClass * obj;
obj = new MyClass();
obj->some_field=some_value;
arr.Add((*obj));
delete obj;
----
Error 2664 Add cannot convert parameter 1 from class MyClass to class
MyClass.
Where is error?? or what I've missed?
.

User: "Victor Bazarov"

Title: Re: CArray 12 Aug 2007 02:53:36 PM
Dymus wrote:

Ok here is sample of code:

CArray <MyClass,MyClass> arr;
MyClass * obj;
obj = new MyClass();

Why not merge the two statements?

obj->some_field=some_value;
arr.Add((*obj));

Why extraneous parentheses?

delete obj;

----
Error 2664 Add cannot convert parameter 1 from class MyClass to class
MyClass.

Where is error?? or what I've missed?

Several things, the most important of which is that this newsgroup
is about C++ langauge, not about MFC. See 'microsoft.public.vc.mfc'
for help on CArray (if it's not MFC, try the newsgroup where it is
relevant), and if it's your own template, provide its definition.
Also, next time you decide to post to a newsgroup for the first time,
use a different approach: first *read* the newsgroup, then find out
where its FAQ is (if any), and read that, and only then, if your
questions haven't been answered, and you figured how to post, do.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.

User: "James Kanze"

Title: Re: CArray 13 Aug 2007 01:19:38 AM
On Aug 12, 9:44 pm, Dymus <dima.petchon...@gmail.com> wrote:

Ok here is sample of code:
CArray <MyClass,MyClass> arr;
MyClass * obj;
obj =3D new MyClass();
obj->some_field=3Dsome_value;
arr.Add((*obj));
delete obj;
Error 2664 Add cannot convert parameter 1 from class MyClass to class
MyClass.
Where is error?? or what I've missed?

Hard to say without seeing the sources of CArray. What type
does CArray<>::Add take as an argument, for example?
--
James Kanze (GABI Software) email:james.ka...@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
.


  Page 1 of 1

1

 


Related Articles
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER