daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Sep 18th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Calling Function Overwrites Value
  2. class flag_type { unsigned int flag; /*more stuff*/ };
  3. flag_type FLAG1
  4. flag_type FLAG2
  5.  
  6. class MyObject {
  7.     public:
  8.         void method1(const flag_type& flag_arg) {
  9.             //conditionals, and then:
  10.             const flag_type flag_args[2] = {flag_arg,flag_arg};
  11.             method2(flag_args);
  12.         }
  13.         void method2(const flag_type flag_args[2]) {
  14.             //conditionals, and then:
  15.             method3(flag_args[0]);
  16.         }
  17.         void method3(const flag_type& flag_arg) { //Actually in a superclass
  18.             //stuff
  19.             if (flag_arg==FLAG1) { /*stuff*/ }
  20.             //stuff
  21.         }
  22. };
  23.  
  24. int main(int argc, const char* argv[]) {
  25.     //In some functions called by main:
  26.     MyObject* obj = new MyObject();
  27.  
  28.     //Later in some other functions:
  29.     obj->method1(FLAG1);
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top