![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Programming A discussion forum for programs and programming used in tech-related businesses. |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 6
OS: 2
|
I am new at C++ and I am having a lot of trouble understanding it. The following is a
homework assignment due this week and I have not idea how to even start it much less finish coding it. Can anyone out there help? Code:
You are to design a class called Employee data members: char name[] long int ID double salary , and two constructors Default construtor Person () Copy constructor Person ( char n[30],long int id,double s) setPerson (char n[30],long int id,double s) that allows user to set information for each person You have to define two classes that derived from class Employee, called Manager and Secretary correspondingly. Each class should inherit all members from the base class and has its own data members and member function as well. For example 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 (permanent, temporary). All member functions of derived class should be overiided from their base class. Each derived class should have an operator << which allows user to output a person’s information to the screen. Write the following main() to test your classes int main() ** Person p ( “Vinh Nguyen”,1234567,500.0); Manager p1(“An Nguyen Vinh”, 0234567, 1000, Dr.); Secretary p2; p2.setPerson(“Lan Vu”, 0341256, 400, permanent); cout << “Manager p1 is “ << p1; cout << “Secretary p2 is “ << p2; return 0; } Thanks in advance ! |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
Design Team Member
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros
|
Re: Employee
Hey, and welcome to TSF. Although we don't do homework i will point you to something that will sort you out =]...
http://www.cprogramming.com/tutorial.html#c++tutorial is a set of free online C++ tutorials, once you've gotten to the 12th you'll be proficcient enough to complete your assignment. It should take between 1 and 3 nights of work so you'll finish within your deadline. And of course if you encounter any problems during the process you can post them in this forum and we'll help you out. Cheers, Jamey |
|
|
|
|
|
#5 (permalink) |
|
Manager, Games Team
|
Re: Employee
Your textbook would probably be the best place to start.
__________________
![]() Donating to the forum keeps TSF free for all. • Common PC Game Issues • Common Installation Issues • Posting System Specs • Power Supply Information • • NVIDIA Drivers • ATI Drivers • Thermal Paste Guide • System Requirements Lab • YouGamers Game-o-Meter • • Everest • Prime95 • DirectX • AMD Drivers • Memtest86 • SensorsView • Driver Cleaner • I do not give help via PM. Please post your question on the forum. |
|
|
|
|
|
#6 (permalink) |
|
Registered User
Join Date: May 2009
Posts: 6
OS: 2
|
Re: Employee
My solution :
Code:
class Employee **
public:
Employee(const char* aName, const Manager* aManager);
const char* name(void) const;
const Manager* manager(void) const;
private:
const char* theName;
const Manager* theManager;
};
class Manager : public Employee **
public:
Manager(const char* aName,
const Manager* aManager,
Secretary* aSecretary = 0);
void setSecretary(Secretary* aSecretary);
Secretary* secretary(void);
private:
Secretary* theSecretary;
};
class Secretary : public Employee
**
public:
Secretary(const char* aName,
const Manager* aManager);
};
|
|
|
|
![]() |
| Thread Tools | |
|
|