Please look at those 3 line.
- A a() - this printed nothing,
- A a - this printed perfectly,
- 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();