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

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

limit string by words??
hello all,

I was wonder if there is a function to limit a string by the number of words inste

Dynamic Array using glob?
Is there an easier way to do this?

I am trying to get create a dyamic array based on files wi

losing session vars when arriving from an email link
Hi,

I've got a confirmation script made that sends an email with a link for a user to confirm

b+ tree
Hi
can every body help me about b+ tree ?(insert & delete)

Update Database
Hi All,


I have a problem with this:

Code: [Select]<?php
session_start();

Select Lists into MYSQL
Hello All, I am new to PHP @ 1 week. So borrowing code anywhere I can. I am making progress, but h

Filtering Tables
Hello Thanks for any help any one can give Im very new to PHP..

I need to pull data for clien

highlighting search terms
well, I started this in the regular PHP section, but it no longer fits there. Suffice it to say, I'm

getting most records by count
Code: [Select]<?php

$connect = mysql_connect("localhost","dam

PHP hyperlinks generator
Hi

I need some help to get this done using php:


1 - I have few hyperlinks say 500

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