Why I can't declare and initialize an object like this in C++?
<p>Suppose I have the following code.</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class A{};
class B{};
class C{
public:
    C(const A &amp;, const B &amp;){cout &lt;&lt; "Constructing C" &lt;&lt; endl;}
};

int main()
{
    C cobj(A(),B());
}
</code></pre>

<p>I WILL NOT have <strong><em>Constructing C</em></strong> displayd on my screen.</p>

<p>But if I write:</p>

<pre><code>int main()
{
    A a;
    B b;
    C cobj(a, b);
}
</code></pre>

<p>I will have <strong><em>Constructing C</em></strong> dispalced on my screen.</p>

<p>Even more, if I write this:</p>

<pre><code>void fun(const A &amp;, const B &amp;)
{
    cout &lt;&lt; "You are in fun!";
}

int main ()
{
    fun(A(), B());
}
</code></pre>

<p>I will have <strong><em>You are in fun!</em></strong> displayed on my screen.</p>

<p>These seems quite inconsistent to me, can anyone explain it?</p>
