What would be the output of the following code snippet?
#include<iostream>
Using namespace std;
class implementAbstraction{
private:
int a,b;
void set(int x,int y)
{
a=x;
b=y;
}
void display()
{
cout<<”a=”<<a<<endl;
cout<<”b=”<<b<<endl;
}
};
int main()
{
implementAbstraction obj;
obj.set(10,20);
obj.display();
return 0;
}
a = 10, b = 20
a = 20, b = 10
Compilation Error
Runtime Error
This question is part of this quiz :
Abstraction,Abstraction and Interfaces,Object Oriented Programming in C++