Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

single class instance versus multiple class instance

Status
Not open for further replies.

ARCITS

Programmer
Apr 4, 2002
99
GB
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top