1

I have following questions and I hope you can help me. Code:

A a; //A(void) is called
A b(a); //A(const A&) is called: direct-initialization
A c = a; //A(const A&) is called: copy-initialization

Why are we differ between these initializations?

1) A b(a);
2) A c = a;

I think in this case both are the same, because each time the copy-constructor is called. Or are we differ because a implicit conversion could be possible in 2)?

But I read that also in this case we differ between the initializations:

3)  int a(5);
4)  int a = 5;

Why are these different initializations? Thank you in advance!

zuuurek
  • 81
  • 1
  • 3

0 Answers0