temporary objects


Posted on 16th Feb 2014 07:03 pm by admin

Until now i thought every temporary object in C++ is created as constant. I'm wondering why my compiler (gcc) is reporting an error on line k.f();, but not g().f(); and g() = k;. Does anyone know?

#include

Did you know?Explore Trending and Topic pages for more stories like this.
class K
{
public:
K(){}
void f(){}
};

K g()
{
K k;
return k;
}

int main()
{
const K k;
k.f();
g().f();
g() = k;
}
No comments posted yet

Your Answer:

Login to answer
91 Like 50 Dislike
Previous forums Next forums
Other forums

Keeping data in form
How can I keep whatever I write in the form?

PHP Form to Variable.
Hi! I have written a HTML-form code in DreamWeaver CS3 (in a PHP doc) and I really need it to work s

what does this mean? +=
is anyone able to explain what this code is saying?

i had it written for me awhile back and n

How to get the previous months last date....
Here's my wittle problem. I suck at working with dates.

So today is 10/20/2009, i need to fig

SAP Logon Failed
I tried to login to SAP through MMC.

When i click start and give password.

it

PHP switch function help
Hi, I am trying to create a search function for a directory website. On the search function on html

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

What's best way to get a user's Word doc converted to simple html and images?
Hi all,

I was just wondering if anybody has any experience of this.
Basically, I'm buildin

Multiple submit forms inside a mysql array page
Hi all,

Im having trouble to get the beneath script to work the thing i can't seem to get wor

php redirecting
i wont open a new thread but i have a question about redirecting....
i wonder why my code doesnt

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash