+ 1

Modifying and Getting enums from other classes?!

I am making a program in c++ were I have made a private enum in a separate class file and I need to modify the value of it from another class which is friend to the other. I tried to make an object and do like: Obj.value = STOP or Obj.value = START but it does not work. What can I do? https://code.sololearn.com/co1HMgfp3tbl/?ref=app

18th Mar 2018, 11:07 AM
xaralampis_
xaralampis_ - avatar
2 Answers
+ 4
To access the enum values, you need to scope the values inside the member functions of class Input. Eg : void Logic::Input() { input.MState = Moving::START; } It seems enums are treated like static objects inside a class.
18th Mar 2018, 11:43 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 1
Thank you again
18th Mar 2018, 11:44 AM
xaralampis_
xaralampis_ - avatar