Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Answer / Irshad Ahamad
Yes, you can have a reference as a data member of a class. To initialize it, you should use the initialization list in the constructor's function body instead of the member initializer list within the class declaration.
| Is This Answer Correct ? | 0 Yes | 0 No |
what are function pointers?
What does iomanip mean in c++?
How the keyword struct is different from the keyword class in c++?
What is the Difference between "vector" and "array"?
15 Answers Covansys, Gambit, TCS, Wipro,
What is tellg () in c++?
How can you link a c program with a c function?
What is c++ w3school?
what is c++
Is c++ free?
What is abstraction with real time example?
Why can templates only be implemented in the header file?
What are guid? Why does com need guids?