home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,739 of 33,346   
   Balog Pal to Dave Harris   
   Re: Singletons   
   16 Dec 12 19:32:36   
   
   From: pasa@lib.hu   
      
   On 11/26/2012 4:51 PM, Dave Harris wrote:   
      
   > One function parameter would be enough, for a "system" object that   
   > holds references to those three other sub systems. You may also find   
   > you can store a reference to the system object in each game object, or   
   > some other place already accessible, so most of the time you don't   
   > need to pass it around at all.   
      
   Ok, that can be done. And what is the benefit of that really? Also, I   
   imagine a situation, where a function was originally:   
      
   void Foo(A a, B b)   
   {   
    ...   
    Global().Bar();   
   }   
      
   After rearranging there no more Global(), but you have reference in both   
   A and B. And here you will keep wondering what on earth to do.   
      
   Call which one, or both? Or start comparing references? Or require an   
   extra param, and pass the problem up one level?   
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca