Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "Triangle.h"
- class RTriangle : public Triangle {
- protected: double z;
- public: RTriangle(double ix, double iy, double iz = 0) :Triangle(ix, iy) { z = iz; }
- ~RTriangle() { cout << "deleting triangle" << endl; }
- void print() { cout << "a triangle with sodes" << x << "and" << y << "and " << z << endl; }
- void area() {
- double p_2 = 0.5*(x + y + z);
- double s = sqrt(p_2*fabs(p_2 - x)*fabs(p_2 - y)*fabs(p_2 - z));
- cout << "has an area of " << s << endl;
- }
- void obwod() { cout << "has a perimeter of" << x << y << z << endl; }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement