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

List:       kde-devel
Subject:    Re: c++ question: code duplication across classes
From:       Frans Englich <englich () kde ! org>
Date:       2006-09-22 14:40:43
Message-ID: 200609221440.43910.englich () kde ! org
[Download RAW message or body]

On Friday 22 September 2006 14:19, Benoit Jacob wrote:
> So I am doing this CRTP thing, and I have a problem: is there a way that
> I can put the operators like operator=, +=, -=, ... in the base class? Or
> am I forced to implement them in each subclass?
>
> When trying to put them in the base class, I'm running into problems as
> C++ specifies that operator= doesn't get inherited by default. I read
> something about the 'using' C++ keyword but that doesn't seem to be
> compatible with templates.
>
> So am I forced to put the operators in the subclasses? No way around that?

I don't have specific suggestions, but thr C++ FAQ Lite is a good start:

http://www.parashift.com/c++-faq-lite/operator-overloading.html
http://www.parashift.com/c++-faq-lite/assignment-operators.html


Cheers,

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