#include<iostream.h>
class B
{
public:
B()
{
cout<<"default constructor"<<endl;
}
B(B& cp)
{
data = cp.data;
cout<<"In copy constructor "<<endl;
}
~B()
{
cout<<"destructed"<<endl;
}
B(int i):data(i) //B(int) works as a converter ( int -> instance of B)
{
cout<<"constructed by parameter "<<data<<endl;
}
private:
int data;
};
B Play()
{
cout<<"In Play()"<<endl;
return B(10000);
}
int main() //constructed by parameter 5
{
B b = Play();
cout<<"Be about to leave/n";
return 0;
}