Q:

What will be the output of the following code?

0

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();
}

  1. inside constructor something destroying 2this is i in main destroying 1
  2. inside constructor something this is i in main destroying 1
  3. inside constructor something destroying 2this is i in main
  4. something destroying 2this is i in main destroying 1

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

 (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

total answers (1)

OBJECT ORIENTED PROGRAMMING OBJECTS AND CLASSES IN OOPS MCQ

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
It is necessary to return the object if it was pas... >>
<< How many objects can be returned at once?...