How can I fix this error: write access violation | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I fix this error: write access violation

Here is my Field-class for my Tic-Tac-Toe game, written in C++: class Field { private: char status; public: static const char EMPTY = ' '; static const char HIDDEN_X = 'X'; static const char HIDDEN_O = 'O'; void setStatus(const char& c) // char c also doesn't work { status = c; } char getStatus() { return status; } Field(char init = EMPTY) { setStatus(init); } }; But sometimes an error appairs if I call setStatus. Can anybody help me, please? (Perhaps "write access violation" is not the right error name, my compailer shows "Ausgelöste Ausnahme: Schreibzugriffsverletzung "**this**" war "0x3"", translated with an non-human translator)

3rd Sep 2020, 1:32 PM
Sebastian Ahlborn
Sebastian Ahlborn - avatar
1 Answer
0
Am Not getting any error. Full code may help to find error.
3rd Sep 2020, 2:04 PM
Jayakrishna 🇮🇳