Introduction to OOP: Chapter 11: Replacement and Refinement [next] [previous] [audio] [real] [text]

Refinement in Object Pascal

procedure Employee.establish;
begin
	writeln("enter employee name:"); readln(name);
	if self.hourlyWorker then begin
		writeln("enter wage"); readln(wage) end;
end;


procedure SalaryEmployee.establish;
begin
		{ execute method from parent class }
	inherited establish;

		{ then do new actions }
	writeln("enter salary: ");
	readln(salary);
end;
Intro OOP, Chapter 11, Slide 19