abt CList
-
consider a class say 'ABC' i want to create a list holding only the ABC pointer locations then is the below the correct way of declaring it : CList x; one more question: if i were to declare it as CList y; ,then how is the second different from the first delclaration?:confused: -- modified at 5:58 Wednesday 22nd February, 2006
-
consider a class say 'ABC' i want to create a list holding only the ABC pointer locations then is the below the correct way of declaring it : CList x; one more question: if i were to declare it as CList y; ,then how is the second different from the first delclaration?:confused: -- modified at 5:58 Wednesday 22nd February, 2006
I don't know, and the MFC collections are confusing to use. I think the first one is the only valid. if you really have to guess about a declaration with MFC collections, then change to STL std::list /// a list of ABC or std::list /// a list of ABC* it's much more clear.
Maximilien Lincourt Your Head A Splode - Strong Bad
-
consider a class say 'ABC' i want to create a list holding only the ABC pointer locations then is the below the correct way of declaring it : CList x; one more question: if i were to declare it as CList y; ,then how is the second different from the first delclaration?:confused: -- modified at 5:58 Wednesday 22nd February, 2006
namaskaaram wrote:
then is the below the correct way of declaring it : CList x;
That is one correct way, but certainly not the only way. For the former:
ABC *a = new ABC(), *b;
x.AddHead(a); // to store
POSITION pos = x.GetHeadPosition();
b = x.GetAt(pos); // to retrieveFor the latter:
ABC a, *b;
x.AddHead(a); // to store
POSITION pos = x.GetHeadPosition();
b = x.GetAt(pos); // to retrieve
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
-
namaskaaram wrote:
then is the below the correct way of declaring it : CList x;
That is one correct way, but certainly not the only way. For the former:
ABC *a = new ABC(), *b;
x.AddHead(a); // to store
POSITION pos = x.GetHeadPosition();
b = x.GetAt(pos); // to retrieveFor the latter:
ABC a, *b;
x.AddHead(a); // to store
POSITION pos = x.GetHeadPosition();
b = x.GetAt(pos); // to retrieve
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
that means the former Clist stores "the pointer locations"(and returns the pointer value) whereas the latter Clist stores the object itself(and returns the pointer of the object stored in the CList)!...is it?:confused:
-
that means the former Clist stores "the pointer locations"(and returns the pointer value) whereas the latter Clist stores the object itself(and returns the pointer of the object stored in the CList)!...is it?:confused:
Correct.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
-
Correct.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
:)thank u sir!!!!!