You are on page 1of 3

// To Sir Hassan Tahir // From: Khalid (Bs-BI Maju) // Sir I hav a serious problem in this code please help

// It is the code that you gav us last time.. // Regarding the rectangle class.. with post fix added # include<iostream> # include<string> using namespace std; class Apple { private: int length; int width; int Area; void setArea() { Area= length * width ; }

// ********** public:

****************************

***********************

Apple () { length=0; width=0; }

Apple (int m, int n) { length=m; width=n; }

void setw (int w) { width=w; }

void setl (int l) { length=l; }

int getArea() { return (Area); }

Apple operator++ (int n) // The post fix !! !! !! { Apple temp(0,0); cout<<"postfix operation"<<endl; temp.width=width++; // we do postifx say in the width .. .. .. this 'll autmtclly chnge the width temp.length= length++; return(temp); }

void DisplayAll () // It is a PUBLIC function tht can access the private function of set area ... ... { cout<<"This is the display function "<<endl; setArea(); getArea(); }

}; // Class closes here

void main () { Apple obj1; Apple obj2(0,0);

obj1.setl(22); obj1.setw(55); obj1++; // Post fix operator overloading called..

obj1.DisplayAll(); // Main display function called.. it contains set/get area.. } // prog ends

// The problem iz: "Set Area" and "The Postfix functn does not works".. // Its a 'logical or syntax' error.. // the main prob is that the set area function does not "works".. // Ahh i'm crash-overloaded..

// BTW Happy Eid Mubarak Sire !!! Hav a wonderful cheerful nd tasty Barka EiD ... (But after solving my code) :) // Thank you sir // My email (if needed): fakhirkhan77@yahoo.com

You might also like