ab8ad9be   
   From: use_my_alias_here_at_hotmail_com@tellus.orb.dotsrc.org   
      
   On 2013-03-13 08:25, Johannes Sixt wrote:   
   > On 12 Mrz., 23:50, DeMarcus   
   > wrote:   
   >> int main()   
   >> {   
   >> Audience a;   
   >> a.watchShow( theDancer );   
   >> //a.runShow( nullptr ); // Won't compile.   
   >> a.watchShow( NULL_ENTERTAINER );   
   >> return 0;   
   >>   
   >> }   
   > ...   
      
   >> Is it justifiable to introduce a NullEntertainer, instantiate it as   
   >> NULL_ENTERTAINER and then overload watchShow() with a   
   >> NullEntertainer argument that isn't used, just to make the code   
   >> slightly more clear and explicit to read?   
   >   
   > A much more obvious solution is to have a function with a new name:   
   >   
   > a.watchBoringShow();   
   >   
   > It doesn't make a difference for the call site because it must make   
   > the decision between whether there is an entertainer or not anyway.   
   > (That in itself sounds like a design error, but that may just be an   
   > artefact of this simplified example.)   
      
   Yes, that's also a way to be more specific. It could have worked   
   unless my real code had this situation in the /constructor/ which I   
   can't change the name of without introducing even more special code,   
   e.g. the Named Constructor Idiom.   
      
   Thanks anyway,   
   Daniel   
      
      
   --   
    [ 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)   
|