Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using standard C++ , please design an abstract class called Employee whose members are as given below (make them protected): Data members: char *name long

Using standard C++, please design an abstract class called Employee whose members are as given below (make them protected):

Data members:

char *name

long int ID

Two constructors:

A Default constructor // intitialize data memebrs to the default values

and a copy constructor

Methods:

setPerson (char *n, long int id) //allows user to set information for each person

A function called Print () // should be a virtual function, that prints the data attributes of the class.

and a destructor

Also define two classes that are derived from class Employee, called Manager and Secretary. Each class should inherit all members from the base class and has its own data members and member functions as well.

The Manager should have a data member called degree for his/her undergraduated degree (e.g. diploma, bachelor, master, doctor), the Secretary should have her contract (can be a Boolean value 1/0 for permanent/temporary).

All member functions of derived class should be overrided from their base class.

Write the following main() to test your classes:

int main() {

Employee * p = new Manager(Bruce Lee, 0234567, Dr.);

P.print();

Secretary p2;

p2.setPerson(Wilma Jones, 0341256, permanent);

delete p;

p = & p2;

p.Print();

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions