Hi I am doing a chapter in my book about delegating to a linked list. When I compile the example in the book :
http://pastebin.com/Ahe8XMb1
http://pastebin.com/xD7UBJtZ
I get : ./headerfile.hpp: In member function 'void PartsCatalog::ShowAll()':
./headerfile.hpp:97:47: error: invalid use of non-static member function 'virtual void Part::Display() const'
void ShowAll() { thePartsList.Iterate(Part::Display); }
So I followed the compliers advice and used static functions instead.
http://pastebin.com/3MKiXHV0
http://pastebin.com/aCL7uR2u
I managed to get the program going but at the end it is supposed to put out the model numbers and model years i.e.
Part Number: 1234
Model Year: 94
Part Number: 2345
Model Year: 93
Part Number: 4434
Model Year: 93
But I get:
(0)Quit (1)Car (2)Plane:
Current Part No: 1
1
New part Number?: 1234
ModelYear?:94
(0)Quit (1)Car (2)Plane:
Current Part No: 1
1
New part Number?: 4434
ModelYear?:93
(0)Quit (1)Car (2)Plane:
Current Part No: 1
1
New part Number?: 1234
ModelYear?:94
1234 was the first entry. Rejected!
(0)Quit (1)Car (2)Plane:
Current Part No: 1
1
New part Number?: 2345
ModelYear?:93
(0)Quit (1)Car (2)Plane:
Current Part No: 1
0
Part Number: 1
Press ENTER to continue...
The part number is not even changing in the class even though the program is able to say it has been repeated.
Please can someone help me fix this, I've tried to make sure my declarations are the same as my definitions and I've followed the compilers advice, tried changing storage types, including return types and moving round * and & but nothings working. Thanks.