Hi,
I am very much confused with the two things i.e. Initialization and assignment.
Can anyone please explain me what exactly these two things
Thanks
Hi,
I am very much confused with the two things i.e. Initialization and assignment.
Can anyone please explain me what exactly these two things
Thanks
Refer to Stroustrup's glossary:
initialization - giving an object an initial value. Initialization differs from assignment in that there is no previous value involved. Initialization is done by constructors.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
suppose I say
int a;
a=123;
then how can we realize this is initialization or assignment
Thanks
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
so if we say
int a=123; then it should be initialization
am I correct
No, rajesh1978's example in post #5 is that of copy initialisation, not "initialisation and assignment", while your example is that of direct initialisation.Originally Posted by Elkvis
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)