vendredi 26 mai 2017

What will be the lifetime of temporary instance?

class A
{
public:
    A()
    {

    }
    A(A &copy)
    {

    }
};
void foo(A a)
{

}
int main()
{
    foo(A());
}

Will the temporary instance generated by calling A() be deleted after the copy constructor has ended or after the function foo has ended?

Aucun commentaire:

Enregistrer un commentaire