C++ Programming - Constructors and Destructors - Discussion
Discussion Forum : Constructors and Destructors - Programs (Q.No. 18)
18.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
int x, y;
public:
IndiaBix()
{
x = 0;
y = 0;
}
IndiaBix(int xx, int yy)
{
x = xx;
y = yy;
}
IndiaBix(IndiaBix *objB)
{
x = objB->x;
y = objB->y;
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
IndiaBix objBix( new IndiaBix(20, 40) );
objBix.Display();
return 0;
}
Discussion:
2 comments Page 1 of 1.
Shrey said:
1 decade ago
@ Shruti ..You are right!! answer is 20 40
Shruti said:
1 decade ago
Answer is 20 40. New IndiaBix is passed as an object, consider it as a copy constructor argument.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers