K
Kavya
Here is the code
------------------------
class circle{
private:
int radius;
public:
circle(int r=0){
radius=r;
}
};
class rectangle{
private:
int length,breadth;
public:
rectangle(int l,int b){
length-l;
breadth=b;
}
operator circle(){
return circle(length);
}
};
int main(){
rectangle r(20,10);
circle c;
c=r;
}
I don't understand what is happening in line c=r. How does this
operator circle( ) function work?
------------------------
class circle{
private:
int radius;
public:
circle(int r=0){
radius=r;
}
};
class rectangle{
private:
int length,breadth;
public:
rectangle(int l,int b){
length-l;
breadth=b;
}
operator circle(){
return circle(length);
}
};
int main(){
rectangle r(20,10);
circle c;
c=r;
}
I don't understand what is happening in line c=r. How does this
operator circle( ) function work?