What is printed by the following piece of code? #include<iostream> using namespa
ID: 3807333 • Letter: W
Question
What is printed by the following piece of code?
#include<iostream>
using namespace std;
class secretType
{
public:
void setXandY(int,int);
void print() const;
void incrementY();
private:
int x;
int y;
};
int main()
{
secretType mine,yours;
mine.setXandY(3,2);
yours.setXandY(4,5);
mine.print();
yours.print();
mine.incrementY();
mine.print();
yours.print();
}
void secretType::setXandY(int a, int b)
{
x = a;
y = b;
}
void secretType::print() const
{
cout << "x = " << x << ", y = " << y << endl;
}
void secretType::incrementY()
{
y++;}
Explanation / Answer
OUTPUT for the above program:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.