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,925 of 33,346   
   Johannes Sixt to use_my_alias_here_at_hotmail_...@te   
   Re: Can I overload with unused arguments   
   13 Mar 13 00:25:28   
   
   ab8ad9be   
   From: j6t@kdbg.org   
      
   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.)   
      
   -- Hannes   
      
      
   --   
         [ 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