Member Avatar for HASHMI007
//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();

}
jonsca commented: Can you ask a question for once, instead of dumping this junk off with no formatting, over and over -2

Recommended Answers

All 4 Replies

Sorry, I have no idea what you want.

Member Avatar for HASHMI007

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

what do you mean by "composition" ?

Member Avatar for HASHMI007

i make this prgram using frnd function.

friend class circle

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.