Hello,
---------muziek.h-------------------------------------------------
#include <iostream>
#include<string>
#include<vector>
using namespace std;
class Muziekbestand
{
protected :
string artiest, naam;
int duur;
string bestandsnaam;
public :
Muziekbestand();
Muziekbestand(string naam);
void afspelen();
void printgegevens();
};
class Muzieklijsten
{
protected :
string naam;
vector<Muziekbestand> *lijst;
public:
Muzieklijsten();
Muzieklijsten(string lijstnaam);
void voegToe(Muziekbestand *a);
void verwijder(int a);
void search();
};
-----------------------------Muziekbestand.cpp----------------------------
#include <iostream>
#include<string>
#include<muziek.h>
using namespace std;
Muziekbestand::Muziekbestand()
{
artiest="";
naam= "";
duur=0;
bestandsnaam ="";
};
Muziekbestand::Muziekbestand(string a)
{
artiest="";
naam="";
duur=0;
bestandsnaam =a;
};
void Muziekbestand::afspelen()
{
cout << "u speelt nu " << naam << " van " << artiest << " met duur " << " en path " << bestandsnaam << endl;
};
void Muziekbestand::printgegevens()
{
cout <<"artiest: " << artiest << endl;
cout <<"naam: " << naam << endl;
cout <<"tijdsduur: " << duur << endl;
cout <<"path: " << bestandsnaam << endl;
};
--------------------------Muzieklijsten.cpp--------------------------------
#include <iostream>
#include<string>
#include<muziek.h>
#include <vector>
using namespace std;
Muzieklijsten::Muzieklijsten()
{
naam ="alle muziek" ;
}
Muzieklijsten::Muzieklijsten(string a)
{
naam=a;
}
void Muzieklijsten::voegToe(Muziekbestand *a)
{
lijst.push_back(a);
}
void Muzieklijsten::verwijder(int a)
{
lijst.erase(a);
}
void search()
{
cout << "geef een zoekwaarde in " << endl;
char ch;
cin >> ch;
};
------------------------------------------------------------------------
the problem here :
I have a class Muzieklijsten(Muziekbestand *a)
As far As I know it means : I will make a class Muzieklijsten and I will use a pointer to 'Muziekbestanden'
In mij class I want to add this pointer to a vector. but here I get the following error:
muzieklijsten.cpp:17: error: request for member `push_back' in `
this->Muzieklijsten::lijst', which is of non-aggregate type `
std::vector<Muziekbestand, std::allocator<Muziekbestand> >*'
muzieklijsten.cpp: In member function `void Muzieklijsten::verwijder(int)':
I have no clue what the problem is here.
I hope some one can solve this
thanks