previous | start | next

Employee Class with C++ string Member

class Employee
{
  string name;
  double salary;
public:
  Employee();
  Employee(const string& nm, double sal);
    
  string getName() const;
  double getSalary() const;

  void setSalary(double newSalary);

};
   

Rule of 3 doesn't apply. So this Employee class needs

How is an Employee variable passed by value? That is, how is a copy made?

How is one Employee variable assigned to another? Does the old employee name get deleted?

When the Employee itself is deallocated, does the string name also get deallocated?



previous | start | next