right right.... so for the code... i could put
Code:
struct Entry {
int ordernum;
string name;
string cnumber;
string hnumber;
string address;
};
class Phonebook
{
public:
void Add();
void Delete();
void Edit();
void Display(fstream *fFile);
void Write(fstream *fFile);
private:
Entry eEntry;
vector<Entry> vEntries;
};
...
...
...
void Phonebook::Add()
{
cout<<"\nName: ";
cin<<eEntry.name;
cout<<"\nCell Phone Number: ";
cin<<eEntry.cnumber;
(so on and so forth)
vEntries.push(eEntry);
}
is this how i would be able to access the private vector eEntries?
And also, is the a proper way to define a class function? Or should it be done in the class definition as well?
Code:
class Phonebook
{
public:
Phonebook(){}
~Phonebook(){}
void Add()
{
cout<<"\nName: ";
cin<<eEntry.name;
cout<<"\nCell Phone Number: ";
cin<<eEntry.cnumber;
(so on and so forth)
vEntries.push(eEntry);
}
void Delete();
void Edit();
void Display(fstream *fFile);
void Write(fstream *fFile);
private:
Entry eEntry;
vector<Entry> vEntries;
};