[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: OT: What is the purpose of virtual_hook anyways?
From:       Waldo Bastian <bastian () suse ! com>
Date:       2005-01-20 15:54:12
Message-ID: 200501201654.12665.bastian () suse ! com
[Download RAW message or body]

On Thursday 20 January 2005 15:03, Jason Keirstead wrote:
> On Thursday 20 January 2005 12:22 am, Thiago Macieira wrote:
> > To solve that problem, declaring d to be a const pointer would probably
> > help, in most cases. That should be a KDE4 policy, just as having
> > d-pointers themselves or virtual hooks.
>
> BTW, what is the purpose of all those virtual_hook methods? I have never
> seen a definition of why these are used, or what purpose they serve - esp.
> since most of them are empty.
>
> Is it also to ensure BC, so that you have a generic entry point of data
> into the class, in case you really need it?
>
> Are there any cases in kdelibs where these methods are in use?

Yes, see e.g. hold() in kio/slave.cpp and kio/dataslave.cpp

We can't make hold() virtual because it would break BC, so we use the 
virtual_hook there.

Cheers,
Waldo
-- 
bastian@kde.org   |   Free Novell Linux Desktop 9 Evaluation Download
bastian@suse.com  |   http://www.novell.com/products/desktop/eval.html

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic