C++ Programming - Constructors and Destructors - Discussion
Discussion Forum : Constructors and Destructors - Programs (Q.No. 12)
12.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
int x;
public:
IndiaBix(short ss)
{
cout<< "Short" << endl;
}
IndiaBix(int xx)
{
cout<< "Int" << endl;
}
IndiaBix(float ff)
{
cout<< "Float" << endl;
}
~IndiaBix()
{
cout<< "Final";
}
};
int main()
{
IndiaBix *ptr = new IndiaBix('B');
return 0;
}
Discussion:
14 comments Page 2 of 2.
Sarvesh karan said:
7 years ago
Int is default return type in c++.
Even in GCC if you just write main() it is treated as int main().
Even in GCC if you just write main() it is treated as int main().
Gayana said:
7 years ago
I agree with you @Raju.
Saman said:
7 years ago
There should be a statement for namespace (using namespace std), otherwise it cause an error.
Raj said:
5 years ago
Why final not printed? Please explain about it.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers