What will be the output of the following code?
Class A
{
int i;
public : A(int n)
{
i=n; cout<<”inside constructor ”;
}
~A()
{
cout<<”destroying ”<<i;
}
void seti(int n)
{
i=n;
}
int geti()
{
return I;
}
};
void t(A ob)
{
cout<<”something ”;
}
int main()
{
A a(1);
t(a);
cout<<”this is i in main ”;
cout<<a.geti();
}
- inside constructor something destroying 2this is i in main destroying 1
- inside constructor something this is i in main destroying 1
- inside constructor something destroying 2this is i in main
- something destroying 2this is i in main destroying 1
(a).inside constructor something destroying 2this is i in main destroying 1
need an explanation for this answer? contact us directly to get an explanation for this answer