assignment operator
-
Hi, Please let me know from below code ..that whether assignment operator or copy constructor is called in each case and why... A is a class.. 1)A a2; A a1=a2; 2)a1=a2; 3)a1(a2);
- Copy constructor (for a1) 2) Assignement operator 3) Syntax is wrong, it should be
A a1(a2);
in which case it is the copy constructor. Why ? Because it is like that :)
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++ - Copy constructor (for a1) 2) Assignement operator 3) Syntax is wrong, it should be
-
Hi, Please let me know from below code ..that whether assignment operator or copy constructor is called in each case and why... A is a class.. 1)A a2; A a1=a2; 2)a1=a2; 3)a1(a2);
Why don't you try yourself? The debugger, you know, it is a fantastic tool... :rolleyes:
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]