Hey.. Names Jay..
I'm new around here.. Doin C++ and i'm a beginner programmer.. I have been going OK but i am stuck!!
For this assessment i have to create a payroll system for a company..
The company must contain staffmembers.. There is a class for staffmembers.. Inheriting frmo this staffmember class, are 3 other classes, (Manager, Casual, Salesperson).
In the company class, these 3 types of staffmembers must be stored in an array..
Using the interface we must create, we must be able to insert a users ID, and from their, be able to edit the specific staffmembers details..
My Dillemma:
How to add the members into their correct array after construction:
(The following is my constructor for a manager)
int managercount = 0;
manager::manager():staffmember()
{
salary = 0;
managercount++;
}
Now i FIGURE i could somehow insert the manager into the themanagers[] array from my company class.. But i am not sure how..
MY IDEA: considering the interface will be used to create these members of staff.. I could create each object using a number system, such as there staff id.. **I am aware i would need to convert that from into to string.. or maybe char? I'm not sure** Therefore: it would be something SIMILAR to below.. However i don't know the correct syntax:
string object_temp;
object_temp = staffID //.. staffID is a static int counting how many staff members have been created and then giving the next number to the next staffmember as their staff ID..
manager object_temp();
If i'm correct, with the correct syntax.. This would make it possible to create an insert function which looked something SIMILAR too (again my syntax is lame because of my lack of knowledge regarding the language so far):
manager::insert(staffID)
{
int ID_temp;
ID_temp = staffID - 1;
themanagers[ID_temp] = staffID // being that the staffID is also the identifier of the object
}
If anyone has an EASIER idea.. Please contact me!! Or if you can help with any of the syntax here i'd be thankful.. Or even a resource already available which may help me?
I apologise for the long post and i also apologise if i have caused anybody discomfort for having to try and understand my jibberish!! ;)
THANK YOU!!!