cs11dotnet7/vscode/Chapter06/Ch06Ex02Inheritance/Shape.cs
2022-02-27 19:08:52 +00:00

37 lines
501 B
C#

namespace Packt.Shared;
public abstract class Shape
{
// fields
protected double height;
protected double width;
// properties
public virtual double Height
{
get
{
return height;
}
set
{
height = value;
}
}
public virtual double Width
{
get
{
return width;
}
set
{
width = value;
}
}
// Area must be implemented by derived classes
// as a read-only property
public abstract double Area { get; }
}