C++ Question
Nolf-Job
Inside each and every one of you!
So I need to create a class and then follow these guidelines
>
Details about the member functions (methods) are as follows:
A. There are no constructors
B. setId() is used to store the id in an Employee object
C. setName() is used to store the name in an Employee object
D. setSalary() is used to store the salary in an Employee object
E. getId() is used to retrieve the id from an Employee object
F. getName() is used to retrieve the name from an Employee object
G. getSalary() is used to retrieve the salary from an Employee object
--Here is my class--
class Employee
{
private:
int id;
string name;
double salary;
public:
void setId(int num)
{id = num;}
void setName(string employeeName)
{name = employeeName;}
void setSalary(double money)
{salary = money;}
void getId()
void getName();
void getSalary();
};
----And here is one of the functions---
void displayEmp(const Employee& emp){
cout << endl << "Name ID Salary: "
<< emp.getName() << " "
<< emp.getId() << " "
<< emp.getSalary(); }
---And my question--
I can't figure out what I need to put for the three "get" functions in my class. Any help?
>
Details about the member functions (methods) are as follows:
A. There are no constructors
B. setId() is used to store the id in an Employee object
C. setName() is used to store the name in an Employee object
D. setSalary() is used to store the salary in an Employee object
E. getId() is used to retrieve the id from an Employee object
F. getName() is used to retrieve the name from an Employee object
G. getSalary() is used to retrieve the salary from an Employee object
--Here is my class--
class Employee
{
private:
int id;
string name;
double salary;
public:
void setId(int num)
{id = num;}
void setName(string employeeName)
{name = employeeName;}
void setSalary(double money)
{salary = money;}
void getId()
void getName();
void getSalary();
};
----And here is one of the functions---
void displayEmp(const Employee& emp){
cout << endl << "Name ID Salary: "
<< emp.getName() << " "
<< emp.getId() << " "
<< emp.getSalary(); }
---And my question--
I can't figure out what I need to put for the three "get" functions in my class. Any help?
0
Comments
int getId(){
return id;
}
return id;
}