c-resources/CPlusPlus20ForProgrammers-m.../examples/Shapes/dd/Shapes.h

46 lines
642 B
C
Raw Normal View History

2024-05-28 06:06:28 +00:00
#include <iostream>
#include <array>
#include <vector>
class Cube {
public:
Cube(){}
Cube(auto _A, auto _B, auto _C): A(_A), B(_B), C(_C){
}
public:
double EvalVolume(){
return A * B * C;
}
std::array<double, 3> GetAll(){
auto tmp {std::array<double, 3>()};
tmp[0]=A;
tmp[1]=B;
tmp[2]=C;
return tmp;
}
void SetAll(auto _A, auto _B, auto _C){
A=_A;
B=_B;
C=_C;
}
void SetA(double x){
A=x;
}
void SetB(double x){
B=x;
}
void SetC(double x){
C=x;
}
const double& GetA(){
return A;
}
const double& GetB(){
return B;
}
const double& GetC(){
return C;
}
private:
double A, B, C, Volume;
};