e.g.
class emp {
private:
......
......
public
void setEmpSalary(double);
void setEmpName(string);
}
main() {
char stores[5];
int i;
for (i = 0; i < 5; ++i) {
emp employee;
employee.setEmpSalary(100.50);
employee.setEmpName("Ghost");
//////
my qns is how do i set per employee object which has the information of salary and its name into the an array?
Please advise. Thank you.
use vector..
vector<emp> employees;
if i can only use array? Any advise?
emp employee[5];
employee[0].setEmpName("GHOST");
...............
can i do it this way?
store[0] = employee; (as in store the class object that contain the information of name and salary?)
must be of same type or object...
emp employee[5];
emp manager;
employee[0] = manager;