previous | start | next

## Real-Life Objects

- Object-oriented programming allows us to easily model entities from real life.
- As an example, the text provides a simple Employee class:
  - All employees have names and salaries which are set at construction.

    >     Employee harry("Hacker, Harry", 45000.00);

  - Both attributes can be queried.

    >     cout << "Name: " << harry.get_name() << "\n";
    >     cout << "Salary: " << harry.get_salary() << "\n";

  - Only salary can be set.

    >     harry.set_salary(new_salary);

previous | start | next