class problem

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
  # include <iostream>
using namespace 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;
}
You haven't declared these functions in your class, only the variables instead. What do you need to do to turn lines 12-13 into function declarations?
Topic archived. No new replies allowed.