#include <CUBE.HPP>
Public Methods | |
| JCube () | |
| JCube (double X) | |
| JCube (double X, double Y) | |
| JCube (double X, double Y, double Length) | |
| double | area () const |
| double | volume () const |
Protected Attributes | |
| JSquare | sq |
| double | area_cache |
| double | volume_cache |
Friends | |
| ostream & | operator<< (ostream &output, const JCube &c) |
|
|
Definition at line 7 of file Cube.cpp. 00008 : sq( 0.0, 0.0, 0.0 ), area_cache( 0.0 ), volume_cache( 0.0 ) { } |
|
|
Definition at line 10 of file Cube.cpp. 00011 : sq( X, 0.0, 0.0 ), area_cache( 0.0 ), volume_cache( 0.0 ) { } |
|
||||||||||||
|
Definition at line 13 of file Cube.cpp. 00014 : sq( X, Y, 0.0 ), area_cache( 0.0 ), volume_cache( 0.0 ) { } |
|
||||||||||||||||
|
Definition at line 16 of file Cube.cpp. 00017 : sq( X, Y, Length ), area_cache( -1.0 ), volume_cache( -1.0 ) { } |
|
|
JCube specific functions. ////////////////////////////////////////////////////////////////////////////.
Definition at line 24 of file Cube.cpp. 00024 { // Area = 6 * square
00025 if ( area_cache < 0.0 ) {
00026 area_cache = 6 * sq.area();
00027 }
00028 return area_cache;
00029 }
|
|
|
Definition at line 32 of file Cube.cpp. 00032 { // sq.length ^ 3
00033 if ( volume_cache < 0.0 ) {
00034 double l = sq.getLength();
00035 volume_cache = l * l * l;
00036 }
00037 return volume_cache;
00038 }
|
|
||||||||||||
|
Definition at line 19 of file CUBE.HPP. 00019 {
00020 output << c.sq;
00021 return output; // Enable cascaded calls
00022 }
|
|
|
|
|
|
Definition at line 25 of file CUBE.HPP. Referenced by operator<<().
|
|
|
|
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001