+ 1

What is use of constructor in c++ programs ?

in c++ program

27th Jul 2017, 11:50 AM
Vivek Kumar
Vivek Kumar - avatar
2 Answers
+ 1
To initialize a user defined type. It is used to allocate memory for variables and run any processing that has to be done before the type can be used. For example, I can use the constructor to read the variables from a text file, or to send signals to another program, or anything like that.
27th Jul 2017, 11:53 AM
Denis Felipe
Denis Felipe - avatar
+ 1
thanks Buddy
27th Jul 2017, 11:58 AM
Vivek Kumar
Vivek Kumar - avatar