Why a std::vector of pointers?
std::vector<Students> works just as well, the C++ library handles the memory management for you. Putting the objects stored on the heap/free store automatically so you don't have to do manual memory management.
Instead of pointer, using references for your constructor:
1 2 3 4 5 6 7 8
|
StudentClub::StudentClub(Student& p, Student& v, Student& s, Student& t, std::vector<Student>& m)
{
president = p;
vicepresident = v;
secretary = s;
treasurer = t;
member = m;
}
| |
In main you declare your vector:
std::vector<Student> clubmem;
Where are all those single-letter variables being declared? Certainly not in main, You are passing non-existent variables into your ctor.
Where is "name" (being passed as a parameter) when creating the instance of a student declared? Not in main.
If they are instantiated in headers then showing the contents of the headers would be helpful.
The single-letter variable names probably means something to you, but they should be descriptive so their names self-document what they are.