-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShape.cs
More file actions
40 lines (34 loc) · 768 Bytes
/
Shape.cs
File metadata and controls
40 lines (34 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
namespace bridge
{
// "Abstraction"
public class Shape
{
protected IColor myColor;
public Shape(IColor color)
{
myColor = color;
}
public virtual string Draw()
{
return "Shape/" + myColor.Draw();
}
}
// "Refined Abstraction"
public class Circle : Shape
{
public Circle(IColor color) : base(color) {}
public override string Draw()
{
return "Circle/" + myColor.Draw();
}
}
// "Refined Abstraction"
public class Square : Shape
{
public Square(IColor color) : base(color) {}
public override string Draw()
{
return "Square/" + myColor.Draw();
}
}
}