Issue with Classes and Chars

I'm trying to make a more complicated version of this to work, this is the more concise version.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int main()	{


	class Title	{

		public:
		char Name;

	};

	Title MyName;

	MyName.Name = "William";


}


I get the error:

1
2
3
4
1
1>  main.cpp
1>main.cpp(13): error C2440: '=' : cannot convert from 'const char [8]' to 'char'
1>          There is no context in which this conversion is possible
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The Name property is a char not a string or char *. Make it a string by replacing char with either char * or string (#include <string> )
Topic archived. No new replies allowed.