Create a class SchoolKid that is the base class for children ar a school . It should have attributes of the child’s name and age , the name of the child’s teacher ,and the greeting. It should have appropriate accessor and mutator methods for each of the attributes. Derive a class ExaggeratingKid from schoolkid , as described above . The new class should override the accessor method for the age , reporting the actual plus 2. It also should override the accessor for the greeting ,returning the child’s greeting concatenated with the words “I am the best”.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
1- Create a class SchoolKid that is the base class for children ar a
school . It should have attributes of the child’s name and age ,
the name of the child’s teacher ,and the greeting. It should have
appropriate accessor and mutator methods for each of the attributes.
Derive a class ExaggeratingKid from schoolkid , as described above .
The new class should override the accessor method for the age ,
reporting the actual plus 2. It also should override the accessor for
the greeting ,returning the child’s greeting concatenated with the
words “I am the best”.
Step by step
Solved in 2 steps with 2 images