Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Andrea Rachetta
hello-ci-lite
Commits
babd2b72
Commit
babd2b72
authored
Jul 26, 2016
by
Yushin Washio
Browse files
Person.h: implement special handling of excellent persons (incomplete)
parent
92bc37ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Person.h
View file @
babd2b72
...
...
@@ -6,6 +6,14 @@ class Person
{
private:
string
name
;
bool
is_excellent
()
{
return
name
==
"Barack Obama"
;
}
bool
is_excellent_female
()
{
return
is_excellent
()
&&
name
!=
"Barack Obama"
;
}
public:
Person
(
string
name
)
:
name
(
name
)
{
...
...
@@ -16,6 +24,20 @@ public:
}
string
hello
(
Person
other
)
{
return
"Hi "
+
other
.
name
+
", how are you?"
;
if
(
other
.
is_excellent
())
{
if
(
other
.
is_excellent_female
())
{
return
"Her Excellency, how are you?"
;
}
else
{
return
"His Excellency, how are you?"
;
}
}
else
{
return
"Hi "
+
other
.
name
+
", how are you?"
;
}
}
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment