Specific Example of Problem

With that as background, now let us consider a specific example that will help illustrate the memory management problems associated with object-oriented programming languages. Imagine a class Window, that has various data fields, such as a height and a width. Now imagine a new class, say TextWindow, that inherits from class Window, and adds a few new data fields.

Finally, imagine that we have an instance of both classes, and we try to assign the value of the textwindow to the variable of type window. What happens?

[audio] [real] Text to accompany slide4, in Chapter 12 of An Introduction to Object-Oriented Programming