Home / Programming MCQs / C++ MCQs / Question
D
Q. What is the output of the following code?
#include <iostream> using namespace std; class MyClass { private: static const int val = 10; public: static int getValue() { return val; } }; int main() { cout << MyClass::getValue() << endl; return 0; }
As a general rule, initialization of data members in the class declaration in C++ is not allowed, but members with “static const” are handled differently and can be initialized in the declaration.
You must be Logged in to update hint/solution
If the user did not supply the value, what value will it take?
What does the sequence adaptor provide?
________ are used to format the data display in CPP.
We can create objects of type ‘abstract class’?
Which of the following cannot be used with the keyword virtual?
How much bytes of memory does void occupy?
What is the correct definition of an array?
The constants are also called as
Classes that can be used to instantiate objects are called?
To perfor file input / output operation in C++, we must include which header file ?
Discusssion
Login to discuss.