Home / Programming MCQs / C++ MCQs / Question
D
Q. What is the output of the following C++ code?
#include <iostream> using namespace std; class MyClass { int var; public: int write(int i) const { var = i; } int read() const { return var; } }; int main(int argc, char const *argv[]) { MyClass obj; obj.write(2); cout << obj.read(); }
No solution found for this question.
Add Solution and get +2 points.
You must be Logged in to update hint/solution
What is the output of below program?
Identify the correct extension of the user-defined header file in C++.
Which one of the following is a keyword?
Which of the following functions are performed by a constructor?
A language able to generate new data types is called
Which part of memory is used for the allocation of local variables declared inside any function.
Which value will it take when both user and default values are given?
___ have the return type void?
What happens if the following C++ statement is compiled and executed?
Discusssion
Login to discuss.