Cannot use any List operations(using Ubuntu)
Hello everyone, I'm trying to construct a header class call Shopper.h, and inside the class I created a list and trying to manipulate using list operation, but every time I try to use any list operation, it doesn't comply. But when i used list operations on cpp file, it works.
Code:
#include <string>
#include <iostream>
#include <list>
using namespace std;
class Shopper{
public:
Shopper(string &n,string &p,list<string> L)
{
name = n;
pro = p;
shopList = L;
{
void delShop()
{
list<Shopper>::iterator i;
i = shopList.begin();
i = shopList.erase(i);
}
//Return the first shop on the list
string firstShop()
{
return shopList.front();
}
string getPro()
{
return pro;
}
string getName()
{
return name;
}
private:
string name;
string pro;
list<string> shopList;
};