0

I have the test code:

struct A
{    
    A (){}

    A (const A & a)
    {
        std::cout<<"copy A";
    }
};

int main()
{
    A a;
    const A& a1 = static_cast<A>(a);

    return 0;
}

My question is why copy constructor is called? UPD: added the description of class A. Program output is: "copy A"

M90
  • 49
  • 1
  • 6

0 Answers0