Advertisement
svetoslavhl

Triangle.cs

Apr 25th, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace OOPGeometry2
  7. {
  8. class Triangle : Figure
  9. {
  10. private double x;
  11. private double h;
  12.  
  13. public double X
  14. {
  15. get { return x; }
  16. set { x = value; }
  17. }
  18.  
  19. public double H
  20. {
  21. get { return h; }
  22. set { h = value; }
  23. }
  24.  
  25. public Triangle(double x, double h)
  26. : base("Triangle")
  27. {
  28. this.x = x;
  29. this.h = h;
  30. }
  31.  
  32. public override double CalculateSurface()
  33. {
  34. return x * h / 2;
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement