Commit babd2b72 authored by Yushin Washio's avatar Yushin Washio
Browse files

Person.h: implement special handling of excellent persons (incomplete)

parent 92bc37ff
......@@ -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?";
}
}
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment