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

List:       kde-devel
Subject:    Re: c++ question: code duplication across classes
From:       Thiago Macieira <thiago () kde ! org>
Date:       2006-09-22 23:54:37
Message-ID: 200609230154.44813.thiago () kde ! org
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


Benoît Jacob wrote:
>I fixed a small test program, just to tell you where I get problems...
> and now it seems that operator= gets inherited!

No, it doesn't. It gets called, which is slightly different.

>I really don't understand. Of course that's fine for me, but I'd like to
> make sure I understand that part of the C++ language before I use it in
> code that'll end up in KDE...

The implicit assignment operator for the derived class calls the 
assignment operator for all the base classes, then for all the member 
variables.

>BTW: Is it OK to hijack kde-devel for general c++ questions? Sorry if
> it's not.

No, not really, but I suppose it's ok as long as we don't abuse it. I've 
learnt a lot from this thread already (CRTP, for instance). So, every 
once in a while, it's good to refresh our knowledge of C++.

I wouldn't like to see kde-devel degenerate into basic C++ questions, like 
how to inherit or what the difference between virtual and non-virtual 
functions is.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

[Attachment #5 (application/pgp-signature)]

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