class Examp{
private:
float *r;
public:
Examp(){
//*r=10.0f;
}
~Examp(){
delete r;
}
Examp(float r){
*(this->r)=r;
}
float circlearea(){
return 3.14*(*r)*(*r);
}
Examp operator +(Examp &e){
Examp ex;
*(ex.r)=*(this->r)+*(e.r);
return ex;
}
void show(){
std::cout<<"Radius :"<<*r<<std::endl;
}
};
Examp *e1=new Examp(10);
Examp *e2=new Examp(5);
Examp *e3=new Examp;
e3=e1+e2;
e1->circlearea();
e2->circlearea();
e2->circlearea();
when I'm executing this code the output is not shown correctly if I try to find the area and sometimes the code below the above object is also not getting executed
I should get the area as my output