This assignment has been designed sothat you would be able implement the concept
ID: 3619387 • Letter: T
Question
This assignment has been designed sothat you would be able implement the concept of composition in OOP. Afterthe completion of this assignment you should have a good grasp onhow to
o Inheritance
o Public & privateinheritance
o Using basic constructsof OOP in a program
Assignment
You have to write a C++ Program in which you will Write aclass ‘person’ which hasthree types of data members name, age and CNIC No. and getName(),getAge() and gerCNIC() functions that returns the name, ageand CNIC No of the person respectively.
Write a second class ‘adult’ which inheritedthe person class and has “implemented in term of”relationship to person. The ‘adult’ classrestrict the functionality of getAge() function by overriding the gatAge() function of person class. You also have to check thecondition if age is greater than 18 then print “AdultPerson”.
If object of adult class is initialized with the age less than18, then it prints a message “age is less than18” and sets the value of age to default.
Explanation / Answer
x.@5tyle="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: none; list-style-position: initial; list-style-image: initial; ">#includeRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.