How many ways are there to initialize an int with a constant?
Answer / nikhil upadhyay
Two.
There are two formats for initializers in C++ as shown in the example that follows. The first format uses the traditional C notation. The second format uses constructor notation.
int foo = 123;
int bar (123);
It's acceptable when a programmer does not know about the second notation, although they should certainly know about the first one. Many old-timer C programmers who made the switch to C++ never use the second idiom, although some wise heads of C++ profess to prefer it. If your applicant is quick with the right answer, that's a good sign.
Is This Answer Correct ? | 0 Yes | 0 No |
Explain how to initialize a const member data.
5. Can inline functions have a recursion?
Why can templates only be implemented in the header file?
What does #define mean in c++?
How do you invoke a base member function from a derived class in which you have not overridden that function?
How did c++ start?
What are the advantages and disadvantages of using inline and const?
2 Answers Polaris, TCS, Zimmer Biomet,
Describe the setting up of my member functions to avoid overriding by the derived class?
What does the following do: for(;;) ; a) Illegal b) Loops forever c) Ignored by compiler...not illegal
What is a manipulative person?
how many trys can we write in one class
What is the default access level?