53 lines
743 B
C++
53 lines
743 B
C++
|
|
||
|
/*class GBaseShape {
|
||
|
public:
|
||
|
GBaseShape();
|
||
|
virtual void EvalVolume();
|
||
|
virtual void EvalSurface();
|
||
|
double GetVolume() const;
|
||
|
double GetVolume() const;
|
||
|
|
||
|
private:
|
||
|
double Volume, Surface;
|
||
|
bool IfVolumeCalculated;
|
||
|
bool IfSurfaceCalculated;
|
||
|
};
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
class Cube {
|
||
|
public:
|
||
|
explicit Cube(double _L = 0, double _W = 0, double _H = 0);
|
||
|
// void SetAll();
|
||
|
void SetL(double _L);
|
||
|
// void SetB(double _B);
|
||
|
// void SetC(double _C);
|
||
|
|
||
|
const double& GetL();
|
||
|
private:
|
||
|
double L,W,H;
|
||
|
};
|
||
|
|
||
|
|
||
|
Cube::Cube(double _L , double _W , double _H ){
|
||
|
SetL(_L);
|
||
|
}
|
||
|
|
||
|
void Cube::SetL(double _L){
|
||
|
L = _L;
|
||
|
}
|
||
|
|
||
|
const double& Cube::GetL() {
|
||
|
return L;
|
||
|
}
|
||
|
|
||
|
int main(){
|
||
|
|
||
|
Cube cube(5);
|
||
|
cube.GetL()++;
|
||
|
return 0;
|
||
|
}
|
||
|
|