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(s tring naam);
void afspelen();
void printgegevens() ;
};
class Muzieklijsten
{
protected :
string naam;
vector<Muziekbe stand> *lijst;
public:
Muzieklijsten() ;
Muzieklijsten(s tring lijstnaam);
void voegToe(Muziekb estand *a);
void verwijder(int a);
void search();
};
-----------------------------Muziekbestand.c pp----------------------------
#include <iostream>
#include<string >
#include<muziek .h>
using namespace std;
Muziekbestand:: Muziekbestand()
{
artiest="";
naam= "";
duur=0;
bestandsnaam ="";
};
Muziekbestand:: Muziekbestand(s tring 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.c pp--------------------------------
#include <iostream>
#include<string >
#include<muziek .h>
#include <vector>
using namespace std;
Muzieklijsten:: Muzieklijsten()
{
naam ="alle muziek" ;
}
Muzieklijsten:: Muzieklijsten(s tring a)
{
naam=a;
}
void Muzieklijsten:: voegToe(Muziekb estand *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(M uziekbestand *a)
As far As I know it means : I will make a class Muzieklijsten and I will use a pointer to 'Muziekbestande n'
In mij class I want to add this pointer to a vector. but here I get the following error:
muzieklijsten.c pp:17: error: request for member `push_back' in `
this->Muzieklijsten: :lijst', which is of non-aggregate type `
std::vector<Muz iekbestand, std::allocator< Muziekbestand> >*'
muzieklijsten.c pp: In member function `void Muzieklijsten:: verwijder(int)' :
I have no clue what the problem is here.
I hope some one can solve this
thanks
---------muziek.h-------------------------------------------------
#include <iostream>
#include<string >
#include<vector >
using namespace std;
class Muziekbestand
{
protected :
string artiest, naam;
int duur;
string bestandsnaam;
public :
Muziekbestand() ;
Muziekbestand(s tring naam);
void afspelen();
void printgegevens() ;
};
class Muzieklijsten
{
protected :
string naam;
vector<Muziekbe stand> *lijst;
public:
Muzieklijsten() ;
Muzieklijsten(s tring lijstnaam);
void voegToe(Muziekb estand *a);
void verwijder(int a);
void search();
};
-----------------------------Muziekbestand.c pp----------------------------
#include <iostream>
#include<string >
#include<muziek .h>
using namespace std;
Muziekbestand:: Muziekbestand()
{
artiest="";
naam= "";
duur=0;
bestandsnaam ="";
};
Muziekbestand:: Muziekbestand(s tring 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.c pp--------------------------------
#include <iostream>
#include<string >
#include<muziek .h>
#include <vector>
using namespace std;
Muzieklijsten:: Muzieklijsten()
{
naam ="alle muziek" ;
}
Muzieklijsten:: Muzieklijsten(s tring a)
{
naam=a;
}
void Muzieklijsten:: voegToe(Muziekb estand *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(M uziekbestand *a)
As far As I know it means : I will make a class Muzieklijsten and I will use a pointer to 'Muziekbestande n'
In mij class I want to add this pointer to a vector. but here I get the following error:
muzieklijsten.c pp:17: error: request for member `push_back' in `
this->Muzieklijsten: :lijst', which is of non-aggregate type `
std::vector<Muz iekbestand, std::allocator< Muziekbestand> >*'
muzieklijsten.c pp: In member function `void Muzieklijsten:: verwijder(int)' :
I have no clue what the problem is here.
I hope some one can solve this
thanks
Comment