I would like to know how to add the objects of a vector?I wrote a code where it is adding the values to a specific object.I wanted to write a code where it can add all the values of all objects in a vector?
I have 3 classes:Company,Department and Employees.Company has collection of departments and each department has collection of employees.
In the department i pushed the elements:
In the Employees i added names and service:
For HR DEPT i added two employees :X ,2
For Techincal dept added 1 employee:Z ,3
With my code i am able to get the total service of first dept(2+3=5).
Now i need to add 3 to that total service.So the total output should be(5+3=8).