Create three classes Person, Professor and Student. The class Person should have data members name and age. The classes Professor and Student should inherit from the class Person. The class Professor should have two integer members: publications and cur_id. There will be two member functions: getdata and putdata. The function getdata should get the input from the user: the name, age and publications of the professor. The function putdata should print the name, age, publications and the cur_id of the professor. The class Student should have two data members: marks, which is an array of size 6 and cur_id. It has two member functions: getdata and putdata. The function getdata should get the input from the user: the name, age, and the marks of the student in 6 subjects. The function putdata should print
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:
Create three classes Person, Professor and Student. The
class Person should have data members name and age. The
classes Professor and Student should inherit from the
class Person.
The class Professor should have two integer
members: publications and cur_id. There will be two member
functions: getdata and putdata. The function getdata should
get the input from the user: the name, age and publications of
the professor. The function putdata should print the name,
age, publications and the cur_id of the professor.
The class Student should have two data members: marks,
which is an array of size 6 and cur_id. It has two member
functions: getdata and putdata. The function getdata should
get the input from the user: the name, age, and the marks of
the student in 6 subjects. The function putdata should print
1,2,3,4,5,6,7,
8,10,11
Students can
be able to
develop the
Professional
Data
Maintenance
System.
the name, age, sum of the marks and the cur_id of the student.
For each object being created of the Professor or
the Student class, sequential id's should be assigned to them
starting from 1.
Solve this problem using virtual functions, constructors, and
static variables. You can create more data members if you
want.
Note: Expand the main function to look at how the input is
being handled.

Step by step
Solved in 2 steps with 1 images









