How do you initialize a class member,
class x {
const int i;
};
Answer Posted / gayatri
using constructor we can initialize a class member in public
part of class.
class x
{
private: int i;
public: x()
{
i = 10;
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is pointer in c++ with example?
What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0
In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....
What are manipulators in c++ with example?
what are the iterator and generic algorithms.
Why the usage of pointers in C++ is not recommended ?
Can c++ do everything c can?
What does h mean in maths?
How a modifier is similar to mutator?
What is the use of bit fields in structure declaration?
What is c++ 11 and c++ 14?
Explain the difference between struct and class in terms of access modifier.
I want explanation for this assignment: how to connect mysql database using c/c++,please explain this detailly?
Explain terminate() and unexpected() function?
Difference between declaration and definition of a variable.