Introduction to OOP Chapter 16: Overriding : next previous audio real text

Overriding for Optimization

Here is an example where a child class can do the same action more efficiently than the parent class. Class Boolean has child classes True and False, and defines the following methods:
"class Boolean"

	& right
		self ifTrue: [ right ifTrue: [ ^ true ] ].
		^ false

	| right
		self ifTrue: [ ^ true ].
		right ifTrue: [ ^ true ].
		^ false
These very general algorithms will work for either true or false values.
Intro OOP, Chapter 16, Slide 10