Void Function error

Can I know what the error is here in my code. I get an error on visual studio saying "redefinition of formal parameter classes"

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  
void getfavoritesubject (string & classes)
{
	string classes;
	cout<<"What is your favorite subject";
	
	cin>>classes;

}
int _tmain(int argc, _TCHAR* argv[])
{
	string replacesubject;

	getfavoritesubject(replacesubject);
Here is my full code. Maybe it has something to do with my enumeration.



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
//Enumeration Function

enum sports { basketball, hockey, football, cricket};
	
//Enumeration for student names
enum computerstudents { fahman, saad, mohsin, waqas};

//Enumeration for classes

enum subjects { history, math, geometry, pe, science};

// Void function display
void getfavoritesubject (string & classes)
{
	string classes;
	cout<<"What is your favorite subject";
	
	cin>>classes;

}
int _tmain(int argc, _TCHAR* argv[])
{
	string replacesubject;

	getfavoritesubject(replacesubject);

	_getch();
	return 0;
}


Nevermind I got it :D. I had declared string classes again in my function.
Topic archived. No new replies allowed.