hey all, i'm making a linked list here and have run into a problem:
i have a soldier cpp where it contains the implementation of the soldier class from a header file.
okay, heres the problem, when in main, i try and call a function from this class and it comes up with:
error C2352: 'Soldier::setRank' : illegal call of non-static member function
here is the set rank in the solder cpp file:
void Soldier::setRank(int totalKills)
{
if (totalKills >= 1000)
{
cout << "Your Rank is a Genreal.." << "\n";
m_Rank = "General";
}
else if (totalKills >= 500)
{
cout << "Your Rank is a Captain.." << "\n";
m_Rank = "Captain";
}
else if (totalKills >= 100)
{
cout << "Your Rank is a Soldier.." << "\n";
m_Rank = "Soldier";
}
else
{
cout << "Your Rank is Trainee.." << "\n";
m_Rank = "Trainee";
}
}
btw i get this error no matter what function i'm calling, but thought to include the implementation and calling of a function.
here is how the function is called from main:
Soldier::setRank(tKills);
thankz 4 any help :)
[Edited by - Twinsen2 on August 3, 2005 6:50:11 AM]