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 are the rules for naming an identifier?
How can you say that a template is better than a base class?
How to give an alternate name to a namespace?
What is struct c++?
Can union be self referenced?
Array base access faster or pointer base access is faster?
How do you clear a map in c++?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
What is the basic structure of a c++ program?
What is the difference between a baller and a reference in C++?
What is setiosflags c++?
Give 10 points of differences between C & C++.
Can c++ do everything c can?
Differentiate between a template class and class template in c++?
How can I learn dev c++ programming?