I have a problem with the structure of my containers classes.
I have various classes using containers such as <vector>
At the moment I just have one class called say 'borrower' which contains the member variables and all of the member functions, see below:
borrower.h file containing -->
class borrower
{
private:
int borrowerNo
...
etc
public:
borrower()
display()
enrol()
...
etc
}
borrower.cpp file containing -->
borrower::borrower
{
}
borrower::enrol()
{
}
...
etc
What I have been trying to do is split up this class and its member functions into two one representing a single instance of the class and the other the container holding multiple instances, so you get say...
borrower.h & borrower.cpp (containing the definition of one instance of the class)
borrowerContainer.h & borrowerContainer.cpp (the container class holding multiple instances of 'borrower')
What I can't seem to get working is how does the container class know about the single instance class? I've got it in my mind that I need to do something like inheritence or make it a friend class which I know is not right? What am I missing?
I tried just #including the borrower class but this didn't work.
Hope this makes sense?
Any help/suggestions appreciated.
I have various classes using containers such as <vector>
At the moment I just have one class called say 'borrower' which contains the member variables and all of the member functions, see below:
borrower.h file containing -->
class borrower
{
private:
int borrowerNo
...
etc
public:
borrower()
display()
enrol()
...
etc
}
borrower.cpp file containing -->
borrower::borrower
{
}
borrower::enrol()
{
}
...
etc
What I have been trying to do is split up this class and its member functions into two one representing a single instance of the class and the other the container holding multiple instances, so you get say...
borrower.h & borrower.cpp (containing the definition of one instance of the class)
borrowerContainer.h & borrowerContainer.cpp (the container class holding multiple instances of 'borrower')
What I can't seem to get working is how does the container class know about the single instance class? I've got it in my mind that I need to do something like inheritence or make it a friend class which I know is not right? What am I missing?
I tried just #including the borrower class but this didn't work.
Hope this makes sense?
Any help/suggestions appreciated.