Write your question here.
when i run this program,it says error 'Rectangle::area' : not a function and Rectangle::perimeter' : not a function,what am i doing wrong? i am a beginner in c++ and just started doing classes.I would appreciate anyone guiding me to do this, thank you.
# include <iostream>
usingnamespace std;
class Rectangle{
private:
int width;
int height;
public:
Rectangle();
~Rectangle();
int area;
int perimeter;
};
Rectangle::Rectangle()
{
width=10;
height=15;
}
Rectangle::~Rectangle()
{
}
int Rectangle::area()
{
return (width*height);
}
int Rectangle::perimeter()
{
return (2*width+2*height);
}
int main()
{
Rectangle r;
cout<<"Area of Rectangl"<<r.area;
cout<<"Perimenter of the rectangle"<<r.perimeter;
system("pause");
return 0;
}