Introduction to OOP: Chapter 14 : Polymorphism [next] [previous] [audio] [real] [text]

Florist Example from Chapter 1

Procedure Spouse.sendFlowersTo(anAddress : address);
begin
	go to florist;
	give florist message sendFlowersTo(anAddress);
end;

Procedure Florist.sendFlowersTo(anAddress : address);
begin
	if address is nearby then
		make up flower arrangement
		tell delivery person sendFlowersTo(anAddress);
	else
		look up florist near anAddress
		phone florist
		give florist message sendFlowersTo(anAddress)
end;
Intro OOP, Chapter 14, Slide 8