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

List:       kde-devel
Subject:    Re: c++ question: code duplication across classes
From:       Benoît_Jacob <jacob () math ! jussieu ! fr>
Date:       2006-09-20 17:44:34
Message-ID: 200609201944.34410.jacob () math ! jussieu ! fr
[Download RAW message or body]

Le mercredi 20 septembre 2006 19:15, Matt Newell a écrit :
> 1.  Having virtual functions will increase the size of an instance of the
> class by sizeof(void*).

Thanks for answering that question! So virtual is really a no-go for me.

>
> 2.  You can do what you want with templates by having the common code not
> in the base class, but in the derived class, and pass the base of the
> derived class as a template argument.
> ...

I think that's the same approach that Sylvain proposed, the "Curiously 
Recurring Template Pattern", right? But anyway it's good to get more example 
code, so thank you :)

Benoit
 
>> 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