Thursday, July 9, 2009

Urgent please C++ !(1) inheritance syntax?

(2) in inheritance i have to use SET DATA , PUT DATA, GET DATA i must have to use or if i don't use is there any problem


plzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz someone help me

Urgent please C++ !(1) inheritance syntax?
for inheritance, u need to give an additional tags while declaring the child class like





class CPolygon {


protected:


int width, height;


public:


void set_values (int a, int b)


{ width=a; height=b;}


};





class CRectangle: public CPolygon {


public:


int area ()


{ return (width * height); }


};





class CTriangle: public CPolygon {


public:


int area ()


{ return (width * height / 2); }


};














for more info just check out





http://www.cplusplus.com/doc/tutorial/in...


No comments:

Post a Comment