How do you initialize a class member,
class x {
const int i;
};
Answer Posted / harminder
It can be done in the intialization list of the constructor
x():i=10
{
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Which one is better- macro or function?
Differentiate between a constructor and a destructor in c++.
What are shallow and deep copy?
Can a constructor be private?
What is doubly linked list in c++?
Why can templates only be implemented in the header file?
Give an example of run-time polymorphism/virtual functions.
How to access a variable of the structure?
Can we declare a base-class destructor as virtual?
what is pre-processor in C++?
Differentiate between late binding and early binding.
What are punctuators in c++?
How can we read/write Structures from/to data files?
By using c++ with an example describe linked list?
How we can differentiate between a pre and post increment operators during overloading?