Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Exercise1
- {
- public abstract class Shape
- {
- private int color;
- public Colors Color
- {
- get
- {
- Colors returnValue = Colors.NONE;
- switch (color)
- {
- case 0x00FF0000:
- returnValue = Colors.RED;
- break;
- case 0x0000FF00:
- returnValue = Colors.GREEN;
- break;
- case 0x000000FF:
- returnValue = Colors.BLUE;
- break;
- }
- return returnValue;
- }
- set
- {
- switch (value)
- {
- case Colors.RED:
- this.color = 0x00FF0000;
- break;
- case Colors.GREEN:
- this.color = 0x0000FF00;
- break;
- case Colors.BLUE:
- this.color = 0x000000FF;
- break;
- }
- }
- }
- public enum Colors
- {
- NONE = 0,
- RED = 1,
- GREEN = 2,
- BLUE = 3
- }
- public abstract double GetArea();
- public abstract double GetPerimeter();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement