initializing an integer array with a constructor

if my constructor looks like this:
1
2
3
4
5
6
employee::employee(int idnum[9],const char* ename)
{
	for(int i=0;i<9;i++)
		id[i]=idnum[i];
	strcpy_s(name,30,ename);
}


how can i pass values to the integer array?

*the defeniion of the calss is this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class employee
{
	int id[9];
	char* name;
	int daysNotPaid;
	bank mybank;
	int accountnum;
	int date[8];
	double balance;
public:
	employee();
	employee(int [9] ,const char*);
	int getid();
	char getname();
	bank getbank();
	int getbankaccount();
	double egtbalance();
	void setdays(int);
	void setbank(bank);
	void setaccountnum(int);
	void setdate(int);
	double setbalance(double);
	void work();
	void printpersoninfo();

};
Last edited on
make an array and then use it as a parameter

1
2
3
int arr[] = {1,2,3,4,5,6,7,8,9};
employee e1(arr, "name");
...

great thanks!
Topic archived. No new replies allowed.