-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiifMethod1.diff
More file actions
60 lines (58 loc) · 1.25 KB
/
diifMethod1.diff
File metadata and controls
60 lines (58 loc) · 1.25 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff --git a/Origin.cpp b/Method1.cpp
index 8f4b641..08b1229 100644
--- a/Origin.cpp
+++ b/Method1.cpp
@@ -39,12 +39,38 @@ public:
}
};
-class RuleA: private CivilCode
+class SpecialLawForSameGender
+{
+public:
+ using Partner = pair<Human, Human>;
+
+ bool isPartner(Partner user)
+ {
+ if( isMale(user.first) == isFemale(user.second) )
+ {
+ return false; //different gender
+ }
+ //... some checks
+ return true;
+ }
+
+ bool isMale(Human user)
+ {
+ return user.gender == PhysicalGender::male;
+ }
+
+ bool isFemale(Human user)
+ {
+ return user.gender == PhysicalGender::female;
+ }
+};
+
+class RuleA: private CivilCode, private SpecialLawFowSameGender
{
public:
bool check(Human a, Human b)
{
- if( isMarried({a, b}) )
+ if( isMarried({a, b}) || isPartner({a, b}) )
{
return true;
}
@@ -52,12 +78,12 @@ public:
}
};
-class RuleB: private CivilCode
+class RuleB: private CivilCode, private SpecialLawFowSameGender
{
public:
bool check(Human a, Human b)
{
- if( isMarried({a, b}) )
+ if( isMarried({a, b}) || isPartner({a, b}) )
{
return true;
}