You have to write a C++ Program in which you will Write aclass ‘ person’ which h
ID: 3619372 • Letter: Y
Question
You have to write a C++ Program in which you will Write aclass ‘person’ which has three typesof data members name, age and CNIC No. and getName(), getAge() andgerCNIC() functions that returns the name, age and CNIC No ofthe person respectively.
Write a second class ‘adult’which inherited the person class and has “implementedin term of” relationship to person. The‘adult’ class restrict the functionality of getAge()function by overriding the gatAge() function of person class.You also have to check the condition if age is greater than 18 thenprint “Adult Person”.
If object of adult class is initialized with the age lessthan 18, then it prints a message “age is less than18” and sets the value of age to default