Jump to content
  • Advertisement
Sign in to follow this  
Steedie

Help me confirm this program class structure

This topic is 4044 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys Just helping my friend with some of their early Com Sci coursework, trouble is, it's been along time since I did any design documents myself Basically the question I'm helping him with is as follows "In this piece of software, there are various types of people - factory staff, managers, board members (owner/chairman etc) It is possible for a person to have multiple roles, such as factory worker-managers. Write basic C++ class declarations for the classes you would use to model this, giving examples of fields and accessors you would expect to see in each of the classes" Now the class structure is pretty simple, he knows how to draw a class diagram once the relationships have been decided so I'm just doing the classes which I feel would be linked as so:
//========================================
//Base class
class cPerson
{
};
//========================================

//========================================
class cFactoryWorker: public cPerson
{
};
//========================================

//========================================
class cManager : public cPerson
{
};
//========================================

//========================================
class cBoard : public cPerson
{
};
//========================================


Which is simple enough, trouble is, I dont really understand what sort of accessors and fields its asking for, as its not a working program as such and just for show, I cant get my head around it What do you guys reckon? Any help would be appreciated, burnt myself out doing my particle system so this is harder than it should be lol

Share this post


Link to post
Share on other sites
Advertisement
Quote:

"In this piece of software, there are various types of people - factory staff, managers, board members (owner/chairman etc)
It is possible for a person to have multiple roles, such as factory worker-managers.

Write basic C++ class declarations for the classes you would use to model this,
giving examples of fields and accessors you would expect to see in each of the classes"

Given that this is homework, even if it isn't yours, I can't provide you a solution. The "solution" they want is practically incorrect anyway; this is a very typical situation used to teach inheritance to unsuspecting CS students. Inheritance is probably a very poor solution to this problem from a real-world perspective. Pointless academic.

Anyway, they probably want you to support "multiple roles" via multiple inheritance. As far as accessors go, the best I can offer you is to consider at least one defining property of each role, and perhaps one defining action, and write prototypes for those methods (for example, you might have Manager::GetPointyHairHeight() and/or Manager::DenySoftwareRequisition()).

Share this post


Link to post
Share on other sites
Yeah that's no problem, wasnt expecting a concrete solution given the circumstances

Was just hoping someone could point me in the right direction or give an indication whether or not the class structure is ok for the problem

Share this post


Link to post
Share on other sites
Quote:
Original post by jpetrie
(for example, you might have Manager::GetPointyHairHeight()


[lol]

OP:
This being homework, I won't say anything specific. But keep in mind what JPetrie said about multiple inheritance, and read this.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!