I am trying to get the hang of classes and I am using football management as the context.
I have the following code so for
Code:
// classes again
#include<iostream>
#include<string.h>
using namespace std;
class Footballer
{
public:
Footballer(char* name, int age, int passing, int shooting, int tackling);
~Footballer();
private:
char _name[256];
int _age;
int _passing;
int _shooting;
int _tackling;
};
Footballer::Footballer(char* name, int age, int passing, int shooting, int tackling)
{
strcpy(_name,name);
_age=age;
_passing=passing;
_shooting=shooting;
_tackling=tackling;
}
Footballer::~Footballer()
{
}
int main(void)
{
Footballer Mark("Mark Sandles",26,5,2,8);
return(0);
}
but to get the true representation of a footballer eventually i would want maybe twice as many parameters for the constructor. I am sure this would not be the way to go so can any one give me an insight into how they would approach the problem
Thanks.