What happens when you attempt to compile and run the following code?
#include
using namespace std;
int op(int x, int y)
{
int i;
i = x + y;
return i;
}
int main()
{
int i=1, j=2, k, l;
k = op(i, j);
l = op(j, i);
cout<< k << "," << l;
return 0;
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class First
{
public:
virtual void Print(){ cout<<"from First";}
};
class Second:public First
{
public:
void Print(){ cout<< "from Second";}
};
void fun(First *obj);
int main()
{
First FirstObject;
fun(&FirstObject);
Second SecondObject;
fun(&SecondObject);
}
void fun(First *obj)
{
obj?>Print();
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
int min(int a, int b);
int main()
{
int b=10;
b = min(5,20);
cout << b;
return 0;
}
int min(int a, int b)
{
if (a
return(a);
else
return(b);
}
What happens when you attempt to compile and run the following code?
#include
using namespace std;
class First
{
public:
First() { cout << "Constructor";}
void Print(){ cout<<"from First";}
};
int main()
{
First FirstObject;
FirstObject.Print();
}