How to program this in c++
•
22 Dec 2011, 17:18
•
Journals
I already made three classes
Werknemer
VasteKracht (derived)
manager (derived)
Im currently stuck at trying to make this into code
How do I get manager to contain multiple werknemers
code looks like this
Werknemer
VasteKracht (derived)
manager (derived)
Im currently stuck at trying to make this into code
How do I get manager to contain multiple werknemers
code looks like this
class VasteKracht extends Werknemer {
}
class Manager extends Werknemer {
private List<WerkNemer> werknemers;
}
do you know the english name for the relation between werknemer and manager?
and then:
public std::list<WerkNemer> werknemers;
you can omit std:: by "using std" or "using std::list", but it's not always recommended. It has all the shit like push pop etc: http://www.cplusplus.com/reference/stl/list/ . Though list is not always recommended performance-wise, there are also vectors, normal arrays and some other stuff.
But it's only an introduction.
get life nerd
###C
seems like one of many solutions
Either way, whether you are storing managers in the worker object, or vice versa, you will have an array of class objects in one of the classes, which should have CRUD functionaly (create, read, update delete) for easy operations. These would be public methods which manipulate the private/protected object array.
can't help more because of this weird language shit.
class VasteKracht {
//
}
class Manager {
//
}
class Werknemer extends Manager {
//
}