I keep getting this syntax error for my code: __tester__.cpp: In function ‘int getCountWatchedMovies(std::__cxx11::string, User*, int, int)’:
__tester__.cpp:123:12: error: ‘user’ was not declared in this scope
if(user[i].username == username){
I don't Know what is wrong with my "user[i]" and why is not declared. Here's my code:
My getter/setter rant:
I'm not a fan of getters and setters when used to essentially make every private variable public. If you're going to do that, you might as well make the variables public and eliminate the getters and setters entirely.
Don't get me wrong, I'm a big believer in private variables. Private variables should be manipulated by functions that implement specific ACTIONs that are relevant to your class.
Getting or setting a variable is rarely an action that is relevant to what your class is representing.
If you find yourself blindly writing getters and setters, then you need to step back and think about what actions are performed on your class and how you're going to implement those actions.
p.s. I know it's popular these days to teach writing getters and setters, but from my point of view, blandly writing them to make private variables public is a concept that should be quickly unlearned.