Thread: MFC: "CDC" obj. Array

  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,130
    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, 03: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, 06:58 PM