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
How would you call C functions from C++ and vice versa?
What is #include cmath?
What are put and get pointers?
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.
What are the defining traits of an object-oriented language?
Explain some examples of operator overloading?
What is a .h file c++?
Explain the isa and hasa class relationships. How would you implement each?
What is boyce codd normal form in c++?
Explain dangling pointer.
What do you mean by function pointer?
In c++, what is the difference between method overloading and method overriding?
Differentiate between a copy constructor and an overloaded assignment operator.
What do you mean by translation unit in c++?
Write a program to encrypt the data in a way that inputs a four digit number and replace each digit by (the sum of that digit plus 7) modulus 10. Then sweep the first digit with the third, second digit with the fourth and print the encrypted number.