[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: RE: Philosophical question
From: "David Leimbach" <leimy2k () gmail ! com>
Date: 2006-11-17 21:35:31
Message-ID: 3e1162e60611171335y26a33c49w18c56e9f49a4b6ec () mail ! gmail ! com
[Download RAW message or body]
On 11/17/06, Paulo Jorge Guedes <Paulo.Guedes@artelecom.pt> wrote:
> > -----Original Message-----
> > From: Remi Villatel [mailto:maxilys@tele2.fr]
> > Sent: sexta-feira, 17 de Novembro de 2006 14:55
> > To: KDE Devel
> > Subject: Philosophical question
> >
> > Hi list,
> >
> > Let's imagine we have: thatThing.isA("QSomeThing") == true.
> >
> > Now, what are the differences in between
> >
> > QSomeThing anotherOne = thatThing;
>
> 1. This initializes anotherOner with the default constructor and then
> assigns to thatThing
Nope. It calls the copy constructor, as long as thatThing is of the
same type as QSomeThing or has a conversion constructor to make a
QSomeThing from "thatThing".
... and the constructor can't be explicit :-).
>
> > and
> >
> > QSomeThing anotherOne(thatThing);
>
> 2. This initializes anotherOne with copy constructor using thatThing
> n
> In theory 2. would be faster but maybe the compiler optimizes 1. so it
> can be the same as 2.
> I'm not sure and would be glad to know :)
>
That's actually not correct either :-). The C++ standard says so, not
the compiler.
I'm not sure if there are legal free copies of the C++ standard
available, I got mine from the ANSI store in PDF format for 18 USD.
Dave
>> 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