Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Calling Function Overwrites Value
- class flag_type { unsigned int flag; /*more stuff*/ };
- flag_type FLAG1
- flag_type FLAG2
- class MyObject {
- public:
- void method1(const flag_type& flag_arg) {
- //conditionals, and then:
- const flag_type flag_args[2] = {flag_arg,flag_arg};
- method2(flag_args);
- }
- void method2(const flag_type flag_args[2]) {
- //conditionals, and then:
- method3(flag_args[0]);
- }
- void method3(const flag_type& flag_arg) { //Actually in a superclass
- //stuff
- if (flag_arg==FLAG1) { /*stuff*/ }
- //stuff
- }
- };
- int main(int argc, const char* argv[]) {
- //In some functions called by main:
- MyObject* obj = new MyObject();
- //Later in some other functions:
- obj->method1(FLAG1);
- }
Add Comment
Please, Sign In to add comment