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,214 of 33,346   
   Seungbeom Kim to Chris Uzdavinis   
   Re: Private Virtual Methods   
   29 Apr 12 12:55:39   
   
   23598ef9   
   From: musiphil@bawi.org   
      
   On 2012-04-27 13:08, Chris Uzdavinis wrote:   
   > On Apr 27, 1:26 pm, Seungbeom Kim  wrote:   
   >   
   >> You missed my point. The question is, why bother to separate the   
   >> virtual implementation from the non-virtual interface in the first   
   >> place? It's because you can put in the non-virtual interface some   
   >> operations that should stay regardless of any future   
   >> overriding. Without the additional operations (including possible   
   >> additions in the future), the separation is meaningless.   
   >   
   > I agree that the post didn't really answer why one would want to use   
   > this technique.  However, I disagree with your conclusion that if you   
   > do not have specific behavior in the base class wrapper function that   
   > this idiom is useless.   
   >   
   > The biggest benefit I see with this technique is it guarantees a base   
   > class the chance to interact with the calls to its virtual functions.   
   > With public virtuals, the base does not even know when/if the function   
   > has been called, and has absolutely no say in interacting with those   
   > calls.  Even if the inline function does nothing today, it's an   
   > insurance policy for the future.  For performance or debugging, you   
   > may find having a place where all calls go through to be extremely   
   > valuable.  If you need to transform the values passed in, you can do   
   > that too. [...]   
      
   Yes, I agree with you. That's why I said "the additional operations   
   *(including possible additions in the future)*" specifically. :-)   
      
   Of course, we never know what we'll want to add later, so we should   
   always take possible additions into account. My point was that that is   
   best illustrated by an example with such an addition, because it is the   
   need for the change in case of an addition that makes the readers truly   
   understand the usefulness of the idiom. My point was not to emphasize   
   that you don't need the idiom when you don't have any additions.   
      
   --   
   Seungbeom Kim   
      
      
         [ 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