Can I have a reference as a data member of a class? If yes, then how do I initialise it?



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

Post New Answer

More C++ General Interview Questions

what are function pointers?

1 Answers  


What does iomanip mean in c++?

1 Answers  


How the keyword struct is different from the keyword class in c++?

1 Answers  


What is the Difference between "vector" and "array"?

15 Answers   Covansys, Gambit, TCS, Wipro,


What is tellg () in c++?

1 Answers  


How can you link a c program with a c function?

1 Answers  


What is c++ w3school?

1 Answers  


what is c++

1 Answers  


Is c++ free?

1 Answers  


What is abstraction with real time example?

1 Answers  


Why can templates only be implemented in the header file?

1 Answers  


What are guid? Why does com need guids?

1 Answers  


Categories