-4
//how can make this program by composite class.plz conver this program using composition...............................!
#include<iostream.h>
#include<stdlib.h>
class point {
friend class circle;
private :

int x,y;
point (int xx,int yy )//:(int x(xx),int y(yy)){}
};
class circle{
float r;
point p1,p2;

public :

circle (){r=0;}
circle (int a,int b,int c,int d){
p1.x=a;p2.x=b;p1.y=c;p2.y=d;
r=(p2.x-p1.x)+(p2.y-p1.y);

}
int area()
{
return 3.1415*r*r;
}

};
int main(){
circle c(1,2,3,4);
cout<<c.area();

}
Votes + Comments
Can you ask a question for once, instead of dumping this junk off with no formatting, over and over
2
Contributors
4
Replies
6
Views
7 Years
Discussion Span
Last Post by HASHMI007
-1

i want make this program by using composition.plz tell me about composition or give me hints,

0

i make this prgram using frnd function.

friend class circle

if we use composite class method.how i change this program.

Edited by HASHMI007: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.