//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();
}

HASHMI007
jonsca commented: Can you ask a question for once, instead of dumping this junk off with no formatting, over and over -2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

HASHMI007
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

HASHMI007
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.