পোস্টগুলি

অক্টোবর, ২০১৯ থেকে পোস্টগুলি দেখানো হচ্ছে

Use of object pointer in c++

Use of object pointer-1 in c++ code: #include<iostream> using namespace std; class Area{     double height,radious; public:     Area(){     radious=0;     height=0;     }     Area(double height,double radious){     this->height=height;     this->radious=radious;     }     ~Area(){     cout<<"Object are distroyed."<<endl;     }     void set(double h,double r){     height=h;     radious=r;     }     double CalCulate(); }; double Area::CalCulate(){     if(height>1){         return 3.1416*radious*radious*height;     }     else{         return 3.1416*radious*radious;     } } int main(...

Friend function in class.

ছবি
Example of friend function in class. simple code: #include<iostream> using namespace std; class integer;//formal diclaration class complex{ int a,b; char sign='+'; int sign1=1; public:     complex(){a=0,b=0;}     complex(int a,int b){         this->a=a;         this->b=b;     }     void show(){         if(b<0) sign1=-1,sign='-';         else sign='+';         cout<<"Complex number : "<<a<<sign<<b*sign1<<'i'<<endl;     }     friend complex add(complex ,integer );     friend complex add(complex ,complex ); }; class integer{     int c;     friend complex add(complex ,integer );     friend complex add(complex ,compl...