Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: non-const r...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 7 Topic 45776 of 46738
Post > Topic >>

Re: non-const reference to tem****ary derived from pure virtual Base

by =?ISO-8859-1?Q?Marcel_M=FCller?= <news.5.maazl@[EMAIL PROTECTED] > May 6, 2008 at 05:16 PM

reppisch schrieb:
>   // not ok!
>   u.useBase(Derived(1));
>   //*  no matching function for call to `User::useBase(Derived)'
>   //*   candidates are: void User::useBase(Base&)
>   // seems that the compiler refuses to make a
>   // non-const reference to a tem****ary

Exactly that. Tem****aries are like rvalues.

I had a similar question some time ago (maybe in the german group). 
Somebody explained me that this is intended by the standard, because 
there are risks otherwise.

You must create a non-tem****ary object for this purpuse.

   Derived d(1);
   u.useBase(d);

Marcel
 




 7 Posts in Topic:
non-const reference to temporary derived from pure virtual Base
reppisch <spam@[EMAIL   2008-05-06 16:41:40 
Re: non-const reference to temporary derived from pure virtual B
reppisch <spam@[EMAIL   2008-05-06 17:17:16 
Re: non-const reference to temporary derived from pure virtual B
Andrey Tarasevich <and  2008-05-06 10:33:20 
Re: non-const reference to temporary derived from pure virtual B
=?ISO-8859-1?Q?Marcel_M=F  2008-05-06 17:16:38 
Re: non-const reference to temporary derived from pure virtual B
=?UTF-8?B?RXJpayBXaWtzdHL  2008-05-06 16:29:20 
Re: non-const reference to temporary derived from pure virtual B
"sk_usenet" <  2008-05-06 09:40:48 
Re: non-const reference to temporary derived from pure virtual B
Andrey Tarasevich <and  2008-05-06 10:45:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 0:01:50 CDT 2008.