Ennio
February 20th, 2008, 10:17 AM
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.
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
(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.
}
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.
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
(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.
}