#include <iostream>
using namespace std;
int main()
{
int k,a=3,b=4;
test*p=new test(3,2);
p->show();
p->get(a,b);
cout<<a<<" "<<b<<endl;
p->set(4);
delete p;
p=new test [3];
p[1].get(a,b);
p[1].show();
cout<<a<<" "<<b<<endl;
b-=7;
p[2].get(a,b);
p[2].show();
cout<<a<<" "<<b<<endl;
p[0].show();
delete []p;
system ("pause");
}
class test{
int x,y;
public:
test(int m=2,int n=3)
{
x=m;
y=n;
}
void set (int t)
{
x=t;
y=t+t;
}
void get (int & m, int & n)
{
x=m;
y=n*2;
m=x+1;
n=y-2;
}
void show ()
{
cout<<x<<" "<<y<<endl;
}
~test()
{
cout<<x*y<<endl;
}
delete []p;
system ("pause");
}
class test{
int x,y;
public:
test(int m=2,int n=3)
{
x=m;
y=n;
}
void set (int t)
{
x=t;
y=t+t;
}
void get (int & m, int & n)
{
x=m;
y=n*2;
m=x+1;
n=y-2;
}
void show ()
{
cout<<x<<" "<<y<<endl;
}
~test()
{
cout<<x*y<<endl;
}
};
What I have tried:
I have tried in code block and in microsoft visual both compilers giving error ?
i upload image of errors on the link down
https://ibb.co/ieRDMb