28 lines
540 B
C++
28 lines
540 B
C++
#pragma once
|
|
#include "Square.h"
|
|
#include "math.h"
|
|
|
|
class SquarePrism :
|
|
public Square
|
|
{
|
|
public:
|
|
double height;
|
|
|
|
SquarePrism(double side, double height):Square(side) {
|
|
this->height = height;
|
|
};
|
|
|
|
double getVolume() {
|
|
return Square::getArea() * this->height;
|
|
};
|
|
|
|
double getArea() override {
|
|
return Square::getArea() * 2 + 4 * this->side * this->height;
|
|
};
|
|
|
|
double getDiagonal() override {
|
|
return sqrt(pow(Square::getDiagonal(), 2) + pow(this->height, 2));
|
|
};
|
|
};
|
|
|