1 #include <iostream>
2
3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
4 using namespace std;
5 class Box
6 {
7 public:
8 Box(int,int);
9 int volume();
10 static int height;
11 int width;
12 int length;
13 };
14
15 Box::Box(int w ,int len)
16 {
17 width=w;
18 length=len;
19 }
20
21 int Box::volume()
22 {
23 return(height*width*length);
24 }
25 int Box::height=10;
26
27 int main(int argc, char** argv) {
28 Box a(15,20),b(20,30);
29 cout<<a.height<<endl;
30 cout<<b.height<<endl;
31 cout<<Box::height<<endl;
32 cout<<a.volume()<<endl;
33 return 0;
34 }