Vector of Objects and Constructors
Hello Guys!
I'm trying implement a conceptual model in C++.
I create this ClassDiagram:
https://dl.dropboxusercontent.com/u/...%20diagram.png
I have a store, with Products.
CdBox is a product, which contains a certain number of cds.
MusicCD is a CDBox, because it can be 1, 2 or 3 CDs.
MusicCD contais a Vector of AudioTracks and the the number of tracks (d_noTracks)
MusicCD has AudioTrack, which has TrackDuration.
I don't know how can I create the "Overload Constructor" with Vector Type.
I don't know how can I "fill" the vector according to the number of Tracks.
You can get full code in:
https://github.com/CreativeSoftware/DiamondSuperStore/
This is my musiccd.h:
Code:
#ifndef MUSICCD_H
#define MUSICCD_H
#include "cdbox.h"
#include "audiotrack.h"
#include <vector>
using namespace std;
class MusicCD: public CdBox
{
int d_noTracks;
vector < AudioTrack > d_MyCd;
public:
//Default Constructor
MusicCD();
//Overload Constructor
MusicCD(int barCode, string const &title, string const &author,
string const &publisher, int price, int noCds,
int noTracks, AudioTrack MyCD);
// Is this right?
// Is this the correct way to initialize MyCD vector into Constructor ?
//Desctructor
~MusicCD();
//Acessor Functions
int noTracks(void) const;
//? Do I need an acessor function to AudioTrack ?
//Mutator Functions
void setNoTracks(int noTracks);
//? How can I set Audio Track?
void fillAudioTrackVector(vector < AudioTrack >&);
void printAudioTrackInfo(void) const;
};
#endif // MUSICCD_H