In this project, our main goal is to understand how to build a class and use its properties and methods by creating objects.
Build an employee class with the mentioned properties and methods below.
- In the
Employeeclass:
- Add the properties below to the Employee class:
int idstring namestring roledouble salary
- Create
printInfo()method, that prints all Employee class properties.
- In the
mainfunction:
-
Create an object of the Employee class
-
Access object properties and assign a value for each one
-
Call
printInfo()method to print object values For example, when running the program, the output should be similar to the following:
ID: 1
Name: Ahmed
Role: Software developer
Salary: 10000
#include <iostream>
using namespace std;
class Employee {
public:
// Add your code here
};
int main(){
// Add your code here
return 0;
};