The abstract class CardView will eventually be matched with an implementation.
This implementation can encapsulate information about the specific
graphics operations of the system.
public class WinFormsCardView : CardView {
public WinFormsCardView (Graphics aGraphicsObject) {
g = aGraphicsObject;
}
public override void display (PlayingCard aCard,int x,int y) {
if (aCard == null) {
Pen myPen = new Pen(Color.Black,2);
Brush myBrush = new SolidBrush (Color.White);
g.FillRectangle(myBrush,x,y,CardView.Width,CardView.Height);
g.DrawRectangle(myPen,x,y,CardView.Width,CardView.Height);
} else {
paintCard (aCard,x,y);
}
}
private void paintCard (PlayingCard aCard,int x,int y) {
...
}
}