1: public class WalletThingBase
2: {
3: protected readonly int MaxLength = 10;
4: protected readonly int MaxWidth = 7;
5: protected readonly int MaxThickness = 1;
6:
7: private int _length = 0;
8: public int Length
9: {
10: get { return this._length; }
11: set
12: {
13: if (value <= 0 || value > this.MaxLength)
14: {
15: throw new ArgumentException("Length is invalid.");
16: }
17:
18: this._length = value;
19: }
20: }
21:
22: private int _width = 0;
23: public int Width
24: {
25: get { return this._width; }
26: set
27: {
28: if (value <= 0 || value > this.MaxWidth)
29: {
30: throw new ArgumentException("Width is invalid.");
31: }
32:
33: this._width = value;
34: }
35: }
36:
37: private int _thickness = 0;
38: public int Thickness
39: {
40: get { return this._thickness; }
41: set
42: {
43: if (value <= 0 || value > this.MaxThickness)
44: {
45: throw new ArgumentException("Thickness is invalid.");
46: }
47:
48: this._thickness = value;
49: }
50: }
51:
52: public WalletThingBase(int length, int width, int thickness)
53: {
54: this.Length = length;
55: this.Width = width;
56: this.Thickness = thickness;
57: }
58: }