ok i try to write a linked list of objects from one class

here is the the class:

class detail{
int code;
string unit;
string name;
float price;

detail(int c, string u, string n, float p);
int get_code(){return code;};
string get_unit(){return unit;};
string get_name(){return name;};
float get_price(){return price;};

detail::detail(int c, string u, string n, float p){

cout << "Enter code:";
cin >> code;
cout << "Enter unit:";
cin >> unit;
cout << "Enter name:";
cin >> name;
cout << "Enter price:";
cin >> price;


And here is the linked list:

template <class T>
struct Element {
?????;	 //here i must to put a pointer to an object from class detail 
Element<T>* next;	 //pointer to next element

template <class T>
class List {
Elem<T>* Begin;	
Elem<T>* End;	

void insertLast(detail aData);	
void print() const;	
void removeAt(unsigned aPos);	

template <class T>
List<T>:: List() {	
Begin = Current = NULL;

template <class T>
void List<T>:: insertLast(T aData) {		
	if(!Begin) {				
	Current->next = new Elem<T>;		
	Current = Current->next;			
	Current->data = aData;			
	Current->next = NULL;			

Could help me at that part with adding an onject in the list?
I don't want to do it with array.I have to do it with pointers only!

InsertLast have to put an element in the last position ,but what i have to do to put an object from class detail in the list?

If your list is generic, then you wouldn't necessarily need to specify the particular class object would you? What do you have there that is a substitute for the name of a type?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.