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
Describe private, protected and public?
What are built-in functions? What is the syntax for the definition?
Explain the difference between new() and malloc() in c++?
What is the benefit of encapsulation?
Is map ordered c++?
What does iomanip mean in c++?
What happens when you make call 'delete this;'?
How do we balance an AVL Tree in C++?
Define a nested class. Explain how it can be useful.
How to declaring variables in c++?
Explain what happens when a pointer is deleted twice?
Do the parentheses after the type name make a difference with new?
What are keywords in c++?
Is c# written in c++?
Why c++ is faster than java?