MFC: "CDC" obj. Array

This is a discussion on MFC: "CDC" obj. Array within the Windows Programming forums, part of the Platform Specific Boards category; i want to make a CDC obj's Array, using MFC, CObArray, CPtrArray, tried these 2., Code: CPtrArray A; A.Add( &CDC::CDC() ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    88

    MFC: "CDC" obj. Array

    i want to make a CDC obj's Array, using MFC,

    CObArray, CPtrArray, tried these 2.,

    Code:
    CPtrArray A;
    A.Add( &CDC::CDC() );
    A[0]->..... not OK
    and this,
    Code:
    CObArray A;
    A.Add( &CDC::CDC() ); // no errer. Is this OK?
    A[0]-> ... can't get element.

    help, pls.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    First, you need a new object: CDC* cdc = new CDC();

    Then, you can add it to a list: A.Add( cdc );

    You added a pointer to the constructor of a CDC object to the list.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    88
    Originally posted by nvoigt
    First, you need a new object: CDC* cdc = new CDC();

    Then, you can add it to a list: A.Add( cdc );

    You added a pointer to the constructor of a CDC object to the list.

    thx, but how do i create CDC obj'z dynamically?

    like this form ,
    Code:
    N = 99;
    
    for( i=0 ; i<N ; i++){
       //CDC *cdc = new CDC();
       A.Add( cdc ); 
    }
    How?
    thx,

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 05-29-2009, 07:25 PM
  2. from 2D array to 1D array
    By cfdprogrammer in forum C Programming
    Replies: 17
    Last Post: 03-24-2009, 10:33 AM
  3. Replies: 6
    Last Post: 11-09-2006, 02:28 AM
  4. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM
  5. Beginning MFC (Prosise) Part III - Now What? :: C++
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 03-03-2002, 05:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21