Ok back to my CD Database:
I'm still trying to add the track list but I decided to implement it with another class mainly because I couldn't figure it out any other way.
So I have a Database Class, with a databaseArray which contains pointers to a CD, another class that I have which contains the artist, title, and year. But in order to get a track list on there, I created a Track class, which lists CD class as it's friend and simply just holds as a private member char* track. Therefore, the CD class holds a trackArray. In my mind this should work out correctly, but for some reason it is not.
So, before I created the track list, I would read in from a file and save each element as a temp string, and then call the add function which takes a pointer to a CD as follows:
Code:Database cdDatabase; char *tempArtist; char *tempTitle; char *tempYear; cdDatabase.addCD(new CD(tempArtist,tempTitle,tempYear));
This all works fine, but when I read in the track list in my reading in loop I get a little confused. What I did was created a temp CD object, and then add the tracks to a temp CD as such:
Now my problem is how to add this to the database. How can I use the first line of code that I stated above add the track list as well. Like I want to add in tempArtist,tempTitle,tempYear, and then the track list but I can't access it from main.
Am I going about this all wrong?