I have an array of (Student)classes created in Manager.h, which contains a new instance of class Name (name),(in Student.h)How would I go about accessing the SetFirstName method in Name.cpp if I was in a class Manager.cpp? I have tried using
Code:
Students[i].name.SetFirstName("name");
but since name is private it is not possible... is there any way to do this??
Thanks,
Code:
// In Manager.h
#include"Student.h"
class Manager
{
static const unsigned int max = 10000;
Student Students[max];
public:
bool b_running;
Manager();
bool AddNewStudent();
};
Code:
// In Student.h
#include "Name.h"
class Student
{
Name name;
public:
Student();
};
Code:
//in Name.cpp
#include "Name.h"
Name::Name(){
}
Name::~Name(){
}
void Name::SetFirstName(char* fName){
firstName = fName;
}
Code:
// In Name.h
class Name
{
char* firstName;
public:
Name();
~Name();
void SetFirstName(char*);
};