CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Apr 2004
    Posts
    5

    new to C++ need some help with dynamic array

    I'm trying to make an Dynamic Array of an Object.

    but the first step I want to make sure I have everything correct creating my Dynamic Array.

    Here is what I have for my .h file.

    Code:
    class course{
        Public:
            course(int maxSize = 1024);
            ~course();
       Private:
            int mySize;
            int maxCapacity;
            string * myArray;
    And here is what I have on my .cpp file
    Code:
    (All the include)...
    course::course(int maxSize):mySize(0), myCapacity(maxSize){
         myArray = new(nothrow) string[maxSize];
    }
    course::~course(){
        delete [] myArray;
    }
    is that correct? I still need to create the copy constructor too I'm working on that now.

    but what I want to know is. Once I have my Dynamic Array how can I make it an array of another class that I have.
    }
    Last edited by Ennio; February 20th, 2008 at 11:27 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured