in my program i have a class witch take two parameter before for intialization for stuff(string name, int id) and when thrying to print the string name and int id of my class i m priting only the int without string.
here is my code please help:
here in my stuffList.cc
// function which take stuff item as parameter
stuff fs(dad,34);// intialization of staff
stuff f2(mam,21);
stuff f3(onkle,12);
stuff f4(tante, 24);
stuffList staffList;
staffList.addMembers(fs);// inserting in the list
staffList.addMembers(f2);
staffList.addMembers( f3);
staffList.addMembers(f4);
staffList.printProperties();// printing the List
So what are the values of the variables dad, mam, tante, and onkle?
You don't show their declarations or initializations.
As a matter of good programming technique:
1) Never ever use namespaces in header files;
2) getStuffName(), getStuffId(), and printProp() should be const
member functions;
3) Pass strings by const reference instead of by value.