Question
#include <iostream>
using namespace std;
class Rect
{
int x, y;
public:
void set_values (int,int);
int area ()
{
return (x * y);
}
};
void Rect::set_values (int a, int b)
{
x = a;
y = b;
}
int main ()
{
Rect recta, rectb;
recta.set_values (5, 6);
rectb.set_values (7, 6);
cout << "recta area: " << recta.area();
cout << "rectb area: " << rectb.area();
return 0;
}
a.
recta area: 30 rectb area: 42
b.
recta area: 20 rectb area: 34
c.
recta area: 30 rectb area: 21
d.
none of the mentioned
Posted under Object Oriented Programming Using C++
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of the program?
Similar Questions
Discover Related MCQs
Q. Pick out the other definition of objects.
View solution
Q. How many objects can present in a single class?
View solution
Q. Which special character is used to mark the end of class?
View solution
Q. Pick the other name of operator function.
View solution
Q. Which of the following operators can’t be overloaded?
View solution
Q. How to declare operator function?
View solution
Q. Operator overloading is
View solution
Q. Which header file is used to declare the complex number?
View solution
Q. How to declare the complex number?
View solution
Q. How many real types are there in complex numbers?
View solution
Q. Which of the following is not a function of complex values?
View solution
Q. What is the return type of the conversion operator?
View solution
Q. Why we use the “dynamic_cast” type conversion?
View solution
Q. How many parameters does a conversion operator may take?
View solution
Q. How types are there in user defined conversion?
View solution
Q. Pick out the correct syntax of operator conversion.
View solution
Q. Which rule will not affect the friend function?
View solution
Q. Which keyword is used to declare the friend function?
View solution
Q. What is the syntax of friend function?
View solution
Q. Pick out the correct statement.
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!