Introduction to OOP Chapter 21: Software Frameworks : next previous audio real text

An Example of a Low Level Abstraction, Sorting Employee Records

Suppose we want to sort employee records. We could write the following.

class Employee {
public:
	string name;
	int salary;
	int startingYear;	
}


void sort (Employee * data[ ], int n) {
	for (int i = 1; i < n; i++) {
		int j = i-1;
		while (j >= 0 && 
		   v[j+1]->startingYear < v[j]->startingYear) {
			// swap elements
			Employee * temp = v[j];
			v[j] = v[j+1];
			v[j+1] = temp;
			j = j - 1;
		}
	}
}

But what happens if we want to change it?
Intro OOP, Chapter 21, Slide 07