I am trying to store a customer in a linked list. I am new to C++ so I have tried to adapt a int linked list to a Customer linked list. This is my code for the customer and list and the main running of it. The errors I get are:
1>c:\users\tashiemoto\desktop\c++\assignmentfinal\assignmentfinal\main4.cpp(12): error C2182: 'addToList' : illegal use of type 'void' 1>c:\users\tashiemoto\desktop\c++\assignmentfinal\assignmentfinal\main4.cpp(12): error C2440: 'initializing' : cannot convert from 'Customer *' to 'int'
Which happens when I try and add a new data entry to the linked list on main.cpp. I always have a red line under addtoList on main. I think it has something to do with customer but I'm not sure.
Main.cpp
#include <iostream>
#include "customer.h"
#include "list.h"
void main ()
{
    //construction
    LinkedList();
    //add a new node to the last
    void addToList( new Customer("hhht","hhh","hhh","hhhkjk","klio"));
}
list.h
#include "customer.h"
//forward declaration
class Node;
//class definition
class LinkedList
{
public:
    //construction
    LinkedList();
    //add a new node to the last
    void addToList(Customer *data);
    //find an element in list and set current pointer
    void find( int key);
    //get data from element pointed at by current pointer
    Customer* getCurrent(void);
    //delete element pointed at by current pointer
    void deleteCurrent(void);
private:
    //data members
    Node *_begin;       //pointer to first element in list
    Node *_end;     //pointer to last element in list
    Node *_current; //pointer to current element in list
};
list.cpp
LinkedList::LinkedList()
{
    //initialise node pointers
    _begin = NULL;
    _end = NULL;
    _current = NULL;
}
void LinkedList::addToList(Customer *data)
{
    Node *newNodePtr;
    //craete new instance of Node
    newNodePtr = new Node;
    //set data
    newNodePtr->setData(data);
    //check if list is empty
    if( _begin == NULL) 
    {
        _begin = newNodePtr;
    }
    else
    {
        newNodePtr->setPrevNode(_end);
        _end->setNextNode(newNodePtr);
    }
    //set current pointer end end pointer
    _end = newNodePtr;
    _current = newNodePtr;
}
Customer.h
   #include <iostream>
   #include<string>
   using namespace std;
   class Customer
   {
       private:
         //
         // class members
         //
         string name; 
         string address;
         string telephone;   
         string sex;
         string dob;
       public:
         // Constructor
         Customer(string init_name, string init_address, string init_telephone, string init_sex, string init_dob);   
         // a print method
         void showPersonDetails(void);
         // This operator is a friend of the class, but is NOT a member of the // class:
         friend ostream& operator <<(ostream& s, Customer& a);
   };  
   // This is the prototype for the overload
    ostream& operator <<(ostream& s, Customer& a);
   #endif
and customer.cpp
#include "customer.h"
using namespace std;
Customer::Customer(string init_name, string init_address, string init_telephone, string init_sex, string init_dob)
{
    name = init_name;
    address = init_address;
    telephone = init_telephone;
    sex = init_sex;
    dob = init_dob;
}
ostream& operator <<(ostream& s, Customer& a)
{
        s << "Name : "         << a.name << endl;
        s << "Address : "      << a.address << endl ;
        s << "Telephone : "    << a.telephone << endl;
        s << "Sex : "          << a.sex << endl ;
        s << "Date of Birth : "<< a.dob << endl;
        return s;
}
 
     
     
     
    