Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. abt CList

abt CList

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    namaskaaram
    wrote on last edited by
    #1

    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

    M D 2 Replies Last reply
    0
    • N namaskaaram

      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

      M Offline
      M Offline
      Maximilien
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • N namaskaaram

        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

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #3

        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 retrieve

        For 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

        N 1 Reply Last reply
        0
        • D David Crow

          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 retrieve

          For 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

          N Offline
          N Offline
          namaskaaram
          wrote on last edited by
          #4

          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:

          D 1 Reply Last reply
          0
          • N namaskaaram

            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:

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            Correct.


            "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

            N 1 Reply Last reply
            0
            • D David Crow

              Correct.


              "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

              N Offline
              N Offline
              namaskaaram
              wrote on last edited by
              #6

              :)thank u sir!!!!!

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups