Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 11 / Examples
diff options
context:
space:
mode:
1 files changed, 2 insertions, 0 deletions
-rw-r--r--Sem. 11/Examples/Person/Person.cpp2
diff --git a/Sem. 11/Examples/Person/Person.cpp b/Sem. 11/Examples/Person/Person.cpp
index a0cc714..439dc2b 100644
--- a/Sem. 11/Examples/Person/Person.cpp
+++ b/Sem. 11/Examples/Person/Person.cpp
@@ -60,6 +60,8 @@ void Person::setName(const char* name)
void Person::setAge(int age)
{
+ if(age < 0 || age > 120)
+ age = 40;
this->age = age;
}