Advertisement
Fhernd

Figura.cs

Nov 14th, 2017
1,079
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.64 KB | None | 0 0
  1. using System;
  2.  
  3. public abstract class Figura
  4. {
  5.     private string idFigura;
  6.    
  7.     public Figura (string idFigura)
  8.     {
  9.         IdFigura = idFigura;            // asigna el valor de idFigura a la propiedad IdFigura
  10.     }
  11.    
  12.     public string IdFigura
  13.     {
  14.         get
  15.         {
  16.             return idFigura;
  17.         }
  18.         set
  19.         {
  20.             idFigura = value;
  21.         }
  22.     }
  23.    
  24.     // La propiedad Area es de sólo-lectura
  25.     public abstract double Area
  26.     {
  27.         get;
  28.     }
  29.    
  30.     public override string ToString ()
  31.     {
  32.         return IdFigura  + " Área = " + string.Format("{0:F2}", Area);
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement