-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathCube.h
More file actions
37 lines (30 loc) · 711 Bytes
/
Cube.h
File metadata and controls
37 lines (30 loc) · 711 Bytes
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
#ifndef CUBE_H
#define CUBE_H
#include "Rectangle.h"
// the word public is the base class access specification
class Cube : public Rectangle
{
private:
double height;
double volume;
public:
Cube() : Rectangle()
{
height = 0.0; volume = 0.0;
}
Cube(double width, double length, double height);
double getHeight() const
{
return height;
}
double getVolume() const
{
return volume;
}
};
Cube::Cube(double width, double length, double height) : Rectangle(width, length)
{
height = height;
volume = getArea() * height; // call parent class function
}
#endif