unable to set a string

When I try running the code below I keep getting an error
that says I can't set the string for Move. The error happens
on line 31 in move class.h. If anyone could help me that would
be great
move class.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <iostream>
#include <tuple>
#include <string>
using namespace std;
using namespace tr1;

class Move{
public:
	Move(){};
	~Move(){};
	void operator = (Move move1);
	void SetValues(string name, int accuracy, int power);
	void SetValues(Move move1);
	string GetName(){return itsName;};
	int GetAccuracy(){return itsAccuracy;};
	int GetPower(){return itsPower;};
private:
	string itsName;
	int itsAccuracy;
	int itsPower;
};
void Move::SetValues(string name, int accuracy, int power){
	itsName=name;
	itsAccuracy=accuracy;
	itsPower=power;
}
void Move::operator =(Move move1){
	SetValues(move1);
}
void Move::SetValues(Move move1){
	itsName=move1.GetName();
	itsAccuracy=move1.GetAccuracy();
	itsPower=move1.GetPower();
}

compmon class.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "move class.h"

typedef tuple <int, int, int, int, int, int, string> Values;
class Compmon{
public:
	Compmon(){};
	~Compmon(){};
	void operator = (Compmon Compmon1);
	void SetValues(int attack, int defense, int health, int attackUp, int defenseUp, int healthUp, string name );
	void SetValues(Values values);
	void SetMove(Move newMove, int moveNumber);
	Move * GetMove(int moveNumber);
	int GetAttack() const {return itsAttack;};
	int GetDefense() const {return itsDefense;};
	int GetHealth() const {return itsHealth;};
	int GetLevel() const {return itsLevel;};
	string GetName() const {return itsName;};
	Values GetValues() ;
	void LevelUp(int levelsUp);
private:
	int itsAttack;
	int itsDefense;
	int itsHealth;
	int itsLevel;
	int itsAttackUp;
	int itsDefenseUp;
	int itsHealthUp;
	string itsName;
	Move itsMoves[4];
	Move * pItsMoves[4];
};
void Compmon::SetValues(int attack, int defense, int health, int attackUp, int defenseUp, int healthUp, string name) {
	itsAttack=attack;
	itsDefense=defense;
	itsHealth=health;
	itsLevel=1;
	itsAttackUp=attackUp;
	itsDefenseUp=defenseUp;
	itsHealthUp=healthUp;
	itsName=name;
}
void Compmon::LevelUp(int levelsUp){
	itsLevel=itsLevel+levelsUp;
	itsAttack=itsAttack+itsAttackUp*levelsUp;
	itsDefense=itsDefense+itsDefenseUp*levelsUp;
	itsHealth=itsHealth+itsHealthUp*levelsUp;
}
Values Compmon::GetValues() {
	Values values(itsAttack, itsDefense, itsHealth, itsAttackUp, itsDefenseUp, itsHealthUp, itsName);
	return values;
}
void Compmon::operator =(Compmon Compmon1){
	SetValues(Compmon1.GetValues());
}
void Compmon::SetValues(Values values){
	itsAttack=get<0>(values);
	itsDefense=get<1>(values);
	itsHealth=get<2>(values);
	itsLevel=1;
	itsAttackUp=get<3>(values);
	itsDefenseUp=get<4>(values);
	itsHealthUp=get<5>(values);
	itsName=get<6>(values);
}
void Compmon::SetMove(Move newMove, int moveNumber){
	itsMoves[moveNumber-1]=newMove;
}
Move * Compmon::GetMove(int moveNumber){
	return pItsMoves[moveNumber-1];
}
Compmon Null;

trainer class.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "compmon class.h"

class Trainer{
public:
	Trainer();
	~Trainer(){};
	Compmon * GetCompmon(int compmonNumber);
	void ChangeCompmon(int compmonNumber, Compmon NewCompmon);
private:
	Compmon * pItsCompmon[6];
	Compmon itsCompmon[6];
};
Trainer::Trainer(){
	itsCompmon[1]=Null;
	itsCompmon[2]=Null;
	itsCompmon[3]=Null;
	itsCompmon[4]=Null;
	itsCompmon[5]=Null;
	itsCompmon[0]=Null;
	pItsCompmon[0]=&itsCompmon[0];
	pItsCompmon[1]=&itsCompmon[1];
	pItsCompmon[2]=&itsCompmon[2];
	pItsCompmon[3]=&itsCompmon[3];
	pItsCompmon[4]=&itsCompmon[4];
	pItsCompmon[5]=&itsCompmon[5];
}
Compmon * Trainer::GetCompmon(int compmonNumber) {
		return pItsCompmon[compmonNumber-1];
}
void Trainer::ChangeCompmon(int compmonNumber, Compmon NewCompmon){
		itsCompmon[compmonNumber-1]=NewCompmon;
}

compmon.cpp
[code]/* --------------Compmon v.1.2 -------------
version completions
v.1.0 1-24-12
v.1.1 1-28-12
v.1.2 uncomplete
*/


#include "trainer class.h"

int Battle(Trainer trainer1, Trainer trainer2);
int main(){
int question;
Move shock;
Move pixelize;
Move memrase;
Move wrap;
Move nothing;
shock.SetValues("shock",100,10);
pixelize.SetValues("pixelize",90,30);
memrase.
Last edited on
Topic archived. No new replies allowed.