Patch for kabc resources

Tobias Koenig tokoe at kde.org
Tue Jan 6 19:52:10 GMT 2004


On Tue, Jan 06, 2004 at 06:53:23PM +0100, David Faure wrote:
> On Tuesday 06 January 2004 18:45, Tobias Koenig wrote:
Hi,

> > Is there any nice design pattern wich covers this issue, so that the
> > method of the base class don't have to be called from every
> > implementation explicitely?
> 
> An easy solution is to separate the public method from the virtual, protected, method.
> Hmm, well the public method is also virtual here, so this would give
> something like
> 
> public:
>  // DO NOT REIMPLEMENT IN SUBCLASSES
>  virtual void writeConfig() {
>     doWriteConfig();
>     BaseClass::writeConfig();
>  }
> 
> protected:
>   virtual void doWriteConfig() { }
> 
> This way you know for sure that the baseclass method is always called,
> and subclasses should only reimplement doWriteConfig (better name
> needed, like writeResourceConfig() or anything more appropriate).
We could make the writeConfig() method protected as well, because only
KRES::Manager should call this method and we can make him a friendclass of
KABC::Resource. Makes this sense?

Ciao,
Tobias
-- 
Can a government that shoots at reporters be democratic?
Separate politics from religion and economy!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20040106/8f2094af/attachment.sig>


More information about the kde-core-devel mailing list