0

Please look at those 3 line.

  1. A a() - this printed nothing,
  2. A a - this printed perfectly,
  3. A a = A() - this also printed perfectly in the below code.
class A
{
public:

    A()
    {
        cout<<"Empty"<<endl ;
    }



};

int main()
{
    A a() ; // Print Nothing
    A a1;  // Printed
    A a2 = A() ; // Printed


}

Why is this happening? I know about default constructor, explicit and implicit call. Moreover in 3rd point what A() returns to left side A a ?

A a = A();

0 Answers0