Home / MCQ Bank / Computer
Computer Classes And Objects In C Plus Plus

What will be the output of the following C++ code? #include <iostream> using namespace std; class rect { int x, y; public: void val (int, int); int area () { return (x * y); } }; void rect::val (int a, int b) { x = a; y = b; } int main () { rect rect; rect.val (3, 4); cout << "rect area: " << rect.area(); return 0; }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • rect area: 12

Related Computer Questions

Consider below sequences. array=60 90 10 100 40 150 90 reverse 2 to 3 array=60 10 90 100 40 150 90 reverse 3 to 6 array= 60 100 150 40 100 90 90 now printout from 1 to 6 :-- 60 100 150 40 100 90 How to achieve the above operation efficiently? What will be the output of the following MySQL command? SELECT emp_id, fname, lname FROM employee WHERE title='HEAD TELLER' AND start_date>2008-11-23; What is the maximum number of possible non zero values in an adjacency matrix of a simple graph with n vertices? Symbol tables during compilation of program is efficiently implemented using ______ Which statement is used to show the server's current character set and collation settings?