Can anyone point out why I am getting these errors two errors.
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
#include "playerType.h"
playerType::playerType(string first, string last, int num, string pos)
: personType(first, last)
{
playerNum = num;
playerPos = pos;
} // end function playerType
void playerType::setPlayerNum(int num)
{
try //Exception Handling
{
if(num < 0 )
throw num;
playerNum = num;
}
catch (int num)
{
cout << "Exception: Player's number must be positive. ";
}
} //end function setPlayerNum
int getNum()
{
return playerNum; //Line (38)
} //end function getNum
void playerType::setPlayerPos(string pos)
{
try //Exception handling
{
if (pos.length() > 2)
throw string("Player's position must be PG, SG, G, SF, PF, F,, FC or C!");
playerPos = pos;
}
catch (string str)
{
cout << "Exception handler: " << str << endl << endl;
}
} //end function setPlayerPos
string getPos()
{
return playerPos; //line (58)
} //end getNum function
void playerType::print()
{
personType::print();
cout << "Player's Number: " << playerNum << endl
<< "Player's Position: " << playerPos << endl << endl;
} //end function print
void playerType::printFile(ostream& outF)
{
outF << left;
outF << setw(14) << getFirstName() << " ";
outF << setw(4) << getNum();
outF << setw(5) << getPos();
}
ERROR
playertype.cpp(38) : error C2065: 'playerNum' : undeclared identifier
playertype.cpp(58) : error C2065: 'playerPos' : undeclared identifier